Please Help! Mikrobasic

General discussion on mikroBasic for AVR.
Post Reply
Author
Message
junkifunki
Posts: 14
Joined: 23 Jun 2008 02:40

Please Help! Mikrobasic

#1 Post by junkifunki » 23 Jun 2008 02:51

Hi All,
We are trying to program PIC 18F458 with Mikrobasic. Our program involves recieving text string "CMD1" via USART and in response to switch High and Low a particular port pin. The code is compied successfully but it's not working while we are sending the command or string "CMD1" via USART to the PIC. I think that we are making some mistake with string thingy. Can any one will have a look at it and rectify the problem. The code is mentioned below.
program test1
delim as string[2]
'dim txt as string[5]
dim fls as word
dim txt2 as string [5]
'dim chkr as string[5]
main:
TRISB =$0

Usart_Init(9600)
'delim = "p"
while TRUE
'chkr = "OK"
PORTB = $01
'if Usart_Data_Ready() = 1 then
if Usart_Data_Ready = 1 then
fls = Usart_Read
WordToStr(fls, txt2)
'Usart_Read_Text(txt, delim)
'if Strcmp(txt," CMD1") = 0 then
if Strcmp(txt2,"CMD1") = 0 then
'PORTB = $00
'Delay_us(100)
PORTB = $00
Delay_ms(1000)
' Usart_Write_Text(chkr)
end if
end if

wend
end.

zuran
Posts: 29
Joined: 19 Oct 2007 08:15
Location: Belgium

#2 Post by zuran » 23 Jun 2008 07:25

you are posting in a AVR forum, while you want answers for a PIC program

Post Reply

Return to “mikroBasic for AVR General”