Just like that mackrackit!!
I, for example, in a project to implement a 10-bit ADC and the output of the pic, I had to generate a 10-bit DAC to simulate approximately the incoming analog signal, so I wrote this (similar to the example):
Adc VAR WORD
D0 VAR Adc.0
D1 VAR Adc.1
D2 VAR Adc.2
D3 VAR Adc.3
D4 VAR Adc.4
D5 VAR Adc.5
D6 VAR Adc.6
D7 VAR Adc.7
D8 VAR Adc.8
D9 VAR Adc.9
TRISA = %11111111
TRISB = %00000000
TRISD = %00000000
ADCON1.7 = 1
Inicio:
ADCIN 0,Adc
PORTD.0 = D0
PORTD.1 = D1
PORTD.2 = D2
PORTD.3 = D3
PORTD.4 = D4
PORTD.5 = D5
PORTD.6 = D6
PORTD.7 = D7
PORTB.0 = D8
PORTB.1 = D9
GoTo Inicio
regards friends!!!
Bookmarks