Hi, Hazda
First of all ... no need to "bomb" the forum with the same question. Once is enough.
second ... here we talk PicBasicPro, and not assembler ...
For what you should do, it's simple : just use a timer interrupt ( see "compare" feature of pics ... and add 1 ms to the value at each interrupt.) to initiate both conversions every 1 ms AND synchronize the timer reset with mains zero crossing.
Here is an example ( in MkBasic ! )
Code:
program Timer1ModeComparaison
' Pic 16F877 @ 8 Mhz
dim comparaison as word
sub procedure interrupt
comparaison = comparaison + 500
CCPR1L = comparaison ' Ecriture poids faibles CCPR1L
CCPR1H = word(comparaison >>8)' Ecriture poids forts CCPR1H
PORTB = PORTB xor %00000001 ' Changement d'etat sortie Toggle output
PIR1 = %00000000
PIE1 = %00000100
INTCON = %11000000
end sub
main:
comparaison = 0
TRISB = 0 ' PORT B en sortie
PORTB = 0
T1CON = 1 ' Validation timer 1 ; Timer1 ON
CCP1CON = %00001010 ' Definition mode comparaison ; compare mode
PIE1 = %00000100 ' Autorisation it comparaison ; Compare interrupt enable
INTCON = %11000000
while true ' Boucle sans fin ; endless loop
wend
end.
it outputs a 1 Khz signal on Portb.0 ... but ,instead, could initiate your conversions !!!
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks