Hi Dwayne,
The project is for an air compressor system. Your project sounds more interesting though. Godd luck with that, and post up some pictures of your work in progress on the airplane.
James.
Hi Dwayne,
The project is for an air compressor system. Your project sounds more interesting though. Godd luck with that, and post up some pictures of your work in progress on the airplane.
James.
Hello James,
They would kill me if I posted pics of a bird here..<g>. I would be more than happy to email pics. But when I get my project done on the PIC, I will post the code and schematic for everyone.
Dwayne
I am using a inductor type system to monitor the RPM. I have found that just 1 turn of wire around the spark wire is more than 50 volts!!
So, what I did, was put a 5V zenor to the base of a PNP, and let the PNP be the trigger to my PIC. Using Pulsein, I count the time between off and on, and for 1000 hz, I get about 960 on my Pulsein calculation. From there I calculate the RPM's via the value of the Pulsein measurement. At the higher RPM, lets say 2000 the value changes to 480, and 4000 RPM the value changes to 240. The higher RPM I loose accuracy, but I could care a less on 50 RPM or so. My Max RPM is about 6200 RPM (Can go to 6600, but it would have to be without the prop). At 8000 RPM, the Value is 120... Thus you have 120 values that represent 4000 RPM (at Highest speed) 4000/120 = 33 RPM per increment...
Dwayne
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
OK, here are some more ramblings. I hope I'm further along the siding and the track is in view?? :-) There are some things missing obviously. I still need to figure out how to put the overflow flag somewhere and count how many times it has been set. 1 flag = 1/10th of an hour. Thats basically the counter that I will be displaying on the seven segments.
Anyway, any help is welcomed. I *think* I'm learning something... ;-)
INCLUDE "modedefs.bas"
define OSC 4
TRISA = %00010000
TRISB = %00000000
T0CON = %00101000
ADCON0 = %00011100
ADCON1 = %01111111
CNT var word
Tenths var word
Units var word
Tens var word
Hundreds var word
Thousands var word
Tenthousands vAR WORD
'RB0 = SEG A
'RB1 = SEG B
'RB2 = SEG C
'RB3 = SEG D
'RB4 = SEG E
'RB5 = SEG F
'RB6 = SEG G
'RA0 = DIGIT1 = TENTHS
'RA1 = DIGIT2 = UNITS
'RA3 = DIGIT3 = TENS
'RA5 = DIGIT4 = HUNDREDS
'RA6 = DIGIT5 = THOUSANDS
'RA7 = DIGIT6 = TENTHOUSANDS
Start:
READ 0,CNT ' Read location 0 and put result into CNT
'(should this be a hi and low)
IF CNT = 0 THEN
SetTimer
ENDIF
If CNT => 1 then '?? i want to put this value into the incremental display
'counter and start counting from this point
endif
'Segment Test LIGHTS ALL SEGMENTS FOR 1SEC
PORTA = %1111011
PORTB = %0111111
PAUSE 1000
PORTA = %0000000
PORTB = %0000000
On Interrupt goto CounterA
SetTimer:
T0CON.0=0 ' Stop the Clock
TMR0H=$AB ' Set Timer Highbyte
TMR0L=$A0 ' Set Timer Lowbyte
T0CON.1=1 ' Restart the Clock
resume
CounterA:
DISABLE
' Interuptable code goes here?
' This is the incremental aspect of the program.
' Any value here is displayed on the segments.
Gosub SetTimer ' Set the Timer for next count
Tenths=Tenths+1 ' Increment 1/10TH minute Counter
If Tenths>9 then
Tenths=0
Units=Units+1 ' Increment the Units
If Units>9 then
Units=0
Tens=Tens+1 ' Increment the Tens
If Tens>9 then
Tens=0
Hundreds=Hundreds+1 ' Increment the Hundreds
If Hundreds>9 then
Hundreds=0
Thousands=Thousands+1 'Increment the Thousands
If Thousands>9 then
Thousands=0
Tenthousands=Tenthousands+1 'Increment the Tenthousands
endif
endif
endif
endif
endif
Resume
' Display code goes here.
End
Bookmarks