![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
hi Jacob,
Did you determine the "2500" output of the accelerometer to be in uSecs.? I have not got an 'acc' on the bench, so I will have to make up an external circuit, probably using a dual mono HEF4528.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
|
(permalink) |
|
I originally assumed that, but then looking into the basic stamp usage of PULSIN, I found that it returned values in 10uS increments. So, 2500 = 25000uS = 25mS at level position. 31.25mS max position and 18.75mS min position.
Last edited by jacob.zurasky; 20th May 2008 at 07:57 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
||
|
|
|
|
|
(permalink) |
|
hi atomsoft,
Looking at the accelerometer, you require two axis. I have written a 'polling' program using Timer1 with PORTA.7 and 6 for the high pulse inputs of X and Y, it works OK. Timer1 prescaler is set for 1:2 so with a 8MHz xtal you get a 1uSec count cycle. As the 'acc' resolution is in mSec, even with this port/pin polling method the accuracy is good. Attached a jpg of the Oshonsoft simulation. I clicked PORTA 7 and 6 pins to give a 'high'. If you would like me to post the program, just say.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 7th July 2008 at 11:24 AM. |
|
|
|
|
|
|
(permalink) |
|
cool! sorry i havent been on lately just having major pc issues spent all day yesterday backing up all my important data now i have to reinstall windows xp today. So please just bare with me. Thanks for all the help and patience guy! Your all great!
__________________
My YouTube Videos! My Favorite Stores: dipmicro Electronics SparkFun Electronics Futurlec BG Micro |
|
|
|
|
|
|
(permalink) |
|
hi atom,
Attached two programs. AccPoll3.asm has LCD subr. When you have reinstalled the Windows XP into your PC, get a free copy of 'hard drive clone'.. using say a spare 40gByte drive, you can make a clone of the hard drive. For future crashes, just clone the 'backup' clone to the new drive. If you keep the cloned backup, upto date, its just a few minutes to get back to normal as all your working programs and data have been cloned.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 7th July 2008 at 11:24 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
__________________
My YouTube Videos! My Favorite Stores: dipmicro Electronics SparkFun Electronics Futurlec BG Micro |
||
|
|
|
|
|
(permalink) | |
|
Quote:
Hi, I use the Seagate HD Wizard, from their website, get the version you can save on a CD.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
||
|
|
|
|
|
(permalink) |
|
I plug in the nearest Linux live disk I have at hand and use dd. It's dead simple to use and does a great job. It will copy any disk of any OS, damaged or not (if disk is damaged, set ignore error option), it doesn't care. It does a raw level copy, not file level. It's free and open source.
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 20th May 2008 at 02:52 PM. |
|
|
|
|
|
|
(permalink) |
|
any links on this linux live disk futz?
__________________
My YouTube Videos! My Favorite Stores: dipmicro Electronics SparkFun Electronics Futurlec BG Micro |
|
|
|
|
|
|
(permalink) |
|
Ok PC now up and running 100% Going to try your code now eric
__________________
My YouTube Videos! My Favorite Stores: dipmicro Electronics SparkFun Electronics Futurlec BG Micro |
|
|
|
|
|
|
(permalink) |
|
Should the INTIO1 be INTIO2 tho?
7. INTIO1 Internal Oscillator with FOSC/4 output on RA6 and I/O on RA7 8. INTIO2 Internal Oscillator with I/O on RA6 and RA7 Also i edited code but still some issue gonna try something brb Code:
;May2008 Atomsoft
;Polling Accelerometer X and Y axis, using PORTA.7 and PORTA.6
;Timer1 holds the count equal to the time A.7 or A.6 are high
;The count is then transferred to XaxisH/L and YaxisH/L
;No LCD display on this version, so delays in the program.
list p=18F1320
include <p18F1320.inc>
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF, DEBUG = ON
XaxisH EQU 0x14
XaxisL EQU 0x15
YaxisH EQU 0x16
YaxisL EQU 0x17
org 0x00
goto Init ;go to start of main code
ORG 0x0008 ;High priority interrupt vector
retfie
ORG 0x0018 ;low priority interrupts
retfie
Init:
movlw 0x72 ; 8MHz clock select
movwf OSCCON
clrf TRISB ;PORTB all outs
bsf TRISA, 6
bsf TRISA, 7
movlw 0x10 ;prescaler 1:2, 8MHz xtal, so 1uSec clock
movwf T1CON ;stop TMR1
Main:
Call Read_X
Call Read_Y
nop
;LCD subr goes here
goto Main
Read_X: ;if PORTA.7 already High, then wait for low
btfsc PORTA,7
return
WaitA7_Hi: ;wait for PORTA.7 to go high
btfss PORTA,7
goto WaitA7_Hi
bsf T1CON,TMR1ON ;start TMR1
WaitA7_Lo:
btfsc PORTA,7
goto WaitA7_Lo
bcf T1CON,TMR1ON ;stop TMR1
;
movf TMR1H,W ;read TMR1 and save count
movwf XaxisH
movf TMR1L,W
movwf XaxisL
clrf TMR1H
clrf TMR1L
return
Read_Y: ;if PORTA.6 already High, then wait for low
btfsc PORTA,6
return
WaitA6_Hi: ;wait for PORTA.6 to go high
btfss PORTA,6
goto WaitA6_Hi
bsf T1CON,TMR1ON
WaitA6_Lo:
btfsc PORTA,6
goto WaitA6_Lo
bcf T1CON,TMR1ON
;
movf TMR1H,W
movwf YaxisH
movf TMR1L,W
movwf YaxisL
clrf TMR1H
clrf TMR1L
return
End
__________________
My YouTube Videos! My Favorite Stores: dipmicro Electronics SparkFun Electronics Futurlec BG Micro Last edited by AtomSoft; 20th May 2008 at 10:32 PM. |
|
|
|
|
|
|
(permalink) |
|
i does in fact get a much steady result maybe like 3a-3e result jumps which is awesome .. Will post some extra code when done making it
__________________
My YouTube Videos! My Favorite Stores: dipmicro Electronics SparkFun Electronics Futurlec BG Micro Last edited by AtomSoft; 20th May 2008 at 10:39 PM. |
|
|
|
|
|
|
(permalink) |
|
Actually varies about digits so 1-8 tops per digit tho like on meter its
2.49v reads L:0x84-0x8A H:0x13 2.50v L:0x98-0x9C H:0x13 2.51v reads L:0xA7-0xAE H:0x13 code: Code:
;May2008 Atomsoft
;Polling Accelerometer X and Y axis, using PORTA.7 and PORTA.6
;Timer1 holds the count equal to the time A.7 or A.6 are high
;The count is then transferred to XaxisH/L and YaxisH/L
;No LCD display on this version, so delays in the program.
list p=18F1320
include <p18F1320.inc>
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF, DEBUG = ON
XaxisH EQU 0x14
XaxisL EQU 0x15
YaxisH EQU 0x16
YaxisL EQU 0x17
org 0x00
goto Init ;go to start of main code
ORG 0x0008 ;High priority interrupt vector
retfie
ORG 0x0018 ;low priority interrupts
retfie
Init:
movlw 0x72 ; 8MHz clock select
movwf OSCCON
clrf TRISB ;PORTB all outs
bsf TRISA, 6
bsf TRISA, 7
movlw 0x10 ;prescaler 1:2, 8MHz xtal, so 1uSec clock
movwf T1CON ;stop TMR1
Main:
Call Read_X
Call Read_Y
nop
goto Main
Read_X: ;if PORTA.7 already High, then wait for low
btfsc PORTA,7
return
WaitA7_Hi: ;wait for PORTA.7 to go high
btfss PORTA,7
goto WaitA7_Hi
bsf T1CON,TMR1ON ;start TMR1
WaitA7_Lo:
btfsc PORTA,7
goto WaitA7_Lo
bcf T1CON,TMR1ON ;stop TMR1
movf TMR1H,W ;read TMR1 and save count
movwf XaxisH
movf TMR1L,W
movwf XaxisL
clrf TMR1H
clrf TMR1L
return
Read_Y: ;if PORTA.6 already High, then wait for low
btfsc PORTA,6
return
WaitA6_Hi: ;wait for PORTA.6 to go high
btfss PORTA,6
goto WaitA6_Hi
bsf T1CON,TMR1ON
WaitA6_Lo:
btfsc PORTA,6
goto WaitA6_Lo
bcf T1CON,TMR1ON
movf TMR1H,W
movwf YaxisH
movf TMR1L,W
movwf YaxisL
clrf TMR1H
clrf TMR1L
return
End
__________________
My YouTube Videos! My Favorite Stores: dipmicro Electronics SparkFun Electronics Futurlec BG Micro Last edited by AtomSoft; 20th May 2008 at 11:12 PM. |
|
|
|
|
|
|
(permalink) |
|
Use the Add Symbol button to add a watch variable.
|
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| 2-axis accelerometer in SOIC package? | Futterama | Electronic Projects Design/Ideas/Reviews | 10 | 27th November 2007 02:10 AM |
| Accelerometer project | kiowamec | Electronic Projects Design/Ideas/Reviews | 9 | 8th October 2007 12:47 AM |
| Accelerometer Interfacing | jimbo1954 | General Electronics Chat | 4 | 25th September 2007 02:06 PM |
| Accelerometer Packages | Stellarcore | Datasheet/Parts Requests | 0 | 13th September 2007 04:10 PM |
| ADXL330 accelerometer with PIC18f452 | erictham83 | Electronic Projects Design/Ideas/Reviews | 0 | 15th August 2006 11:44 AM |