usart communcation!

General discussion on mikroBasic for AVR.
Post Reply
Author
Message
bobo99
Posts: 3
Joined: 03 Apr 2007 18:02

usart communcation!

#1 Post by bobo99 » 07 Jun 2007 00:37

Hi there, I have after a very long time finally established pic to pc communcation via usart. I am trying to type in a number in the terminal and tell the pic to light up the corresponding led. I am using a 16f876 chip and have all the portB pins breadboarded to leds. My code is:

dim i as byte
TRISB = 0
main:
Usart_init(2400) ' Initialize USART module (8 bit, 2400 baud rate, no parity bit...
while true
if Usart_Data_Ready = 1 then ' If data is received:
i = Usart_Read ' Read the received data
Usart_Write(i)
PORTB.i = 1
end if
wend
end.

now i am wondering if i even properly wrote the part about PORTB.i = 1... i know the code doesnt work so i must of slipped up somewhere, I know the pic is receiving my numbers because Usart_Wrute(i) works...


bojan

MrChips
Posts: 39
Joined: 12 Dec 2006 13:59

#2 Post by MrChips » 08 Jul 2007 16:33

is good that now you have RS232 comms

and perhaps this post would be better in the PIC forum ?

:lol: :lol: :lol: .

MC
If you cant help ,then you cant help it

Post Reply

Return to “mikroBasic for AVR General”