serial communication

Thread Starter

mah

Joined Mar 15, 2010
393
hi every body
could you help me to do a program convert analog value to digital using pic16f877 and send it via serial port
thank you
 

Tahmid

Joined Jul 2, 2008
343
Hi,
Which language and compiler are you using?
How far have you progressed?
Do you require 10-bit value or 8-bit value?
 

Tahmid

Joined Jul 2, 2008
343
Hi,
In mikroBASIC, you could do it like this:
Rich (BB code):
program ADC_UART_16F877
'16F877
'Clock: 8MHz

dim ADCResult as word

main:
     UART1_Init(9600) 'Initialize UART at 9600bps
     while true
           ADCResult = ADC_Read(0) >> 2 'Read analog value from channel 0 and convert to 8-bit
           UART1_Write(ADCResult) 'Write to serial port
           delay_ms(100)
     wend
end.
Hope this helps.
Tahmid.
 
Top