Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 20th May 2008, 07:02 AM   (permalink)
Default

Quote:
Originally Posted by jacob.zurasky View Post
Any luck with it?
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/
ericgibbs is offline   Reply With Quote
Old 20th May 2008, 07:55 AM   (permalink)
Default

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.
jacob.zurasky is offline   Reply With Quote
Old 20th May 2008, 08:00 AM   (permalink)
Default

Quote:
Originally Posted by jacob.zurasky View Post
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.
Many thanks.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is offline   Reply With Quote
Old 20th May 2008, 12:03 PM   (permalink)
Default

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.
Attached Images
File Type: jpg AccPoll3.jpg (155.6 KB, 7 views)
__________________
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.
ericgibbs is offline   Reply With Quote
Old 20th May 2008, 01:05 PM   (permalink)
Default

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!
AtomSoft is offline   Reply With Quote
Old 20th May 2008, 01:33 PM   (permalink)
Default

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.
Attached Files
File Type: asm AccPoll2.asm (1.6 KB, 2 views)
File Type: asm AccPoll3.asm (6.4 KB, 2 views)
__________________
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.
ericgibbs is offline   Reply With Quote
Old 20th May 2008, 02:21 PM   (permalink)
Default

Quote:
Originally Posted by ericgibbs View Post
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.
Cool i actually have a spare 80 but my HD is 250GB and it would be a long pain to clone it but since im going to format it will only take like 7gb of space and ill clone then
AtomSoft is offline   Reply With Quote
Old 20th May 2008, 02:39 PM   (permalink)
Default

Quote:
Originally Posted by AtomSoft View Post
Cool i actually have a spare 80 but my HD is 250GB and it would be a long pain to clone it but since im going to format it will only take like 7gb of space and ill clone then

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/
ericgibbs is offline   Reply With Quote
Old 20th May 2008, 02:49 PM   (permalink)
Default

Quote:
Originally Posted by ericgibbs View Post
I use the Seagate HD Wizard, from their website, get the version you can save on a CD.
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.
futz is offline   Reply With Quote
Old 20th May 2008, 07:22 PM   (permalink)
Default

any links on this linux live disk futz?
AtomSoft is offline   Reply With Quote
Old 20th May 2008, 09:42 PM   (permalink)
Default

Ok PC now up and running 100% Going to try your code now eric
AtomSoft is offline   Reply With Quote
Old 20th May 2008, 10:26 PM   (permalink)
Default

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
For some reason my watch window doesnt let me put the variable in it...

Last edited by AtomSoft; 20th May 2008 at 10:32 PM.
AtomSoft is offline   Reply With Quote
Old 20th May 2008, 10:38 PM   (permalink)
Default

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

Last edited by AtomSoft; 20th May 2008 at 10:39 PM.
AtomSoft is offline   Reply With Quote
Old 20th May 2008, 11:11 PM   (permalink)
Default

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

Last edited by AtomSoft; 20th May 2008 at 11:12 PM.
AtomSoft is offline   Reply With Quote
Old 20th May 2008, 11:45 PM   (permalink)
Default

Use the Add Symbol button to add a watch variable.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
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



All times are GMT. The time now is 10:26 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.