I am writing a code in protonbasic 1.0.3.6 to read the analogue signal from AN0 and then send it to max232. Here is the code:
Include "PROTON_G4.INT"
Device = 18F452
Dim sample As Word
TRISA = %00000001
ADCON0 = %11000001
ADCON1 = %11001110
again:
sample = ADIn 0
DelayMS 2
HRSOut sample ;
GoTo again
Now i need to set sampling frequency to 500 Hz, I think i need to use a timer but dont know how to. Besides , i don't know what is the internal frequency of the pic that i am using, is it easier to use a crystal?
Bookmarks