Sonsivri

Electronics => Pic Basic Languages => Topic started by: hsny on August 11, 2007, 05:33:38 17:33



Title: cant communicate pc to pic
Post by: hsny on August 11, 2007, 05:33:38 17:33
this serin doesnt work.I use max232 and get the characters on hyperterminal but cant on led.
please help.


T2400 con 0
serindata var byte

SerOut PORTB.0 , T2400 , ["1-PORTA.0 Yuksek Yap ",13,10]
SerOut PORTB.0 , T2400 , ["2-PORTA.0 Dusuk Yap",13,10]
SerOut PORTB.0 , T2400 , ["3-Program Sonu",13,10]

loop:
 SerIn PORTB.1 , T2400 , [serindata]
    select case serindata
       case "1"
       high PORTA.0
       case "2"
       low PORTA.0
       case "3"
       serout PORTB.0 , T2400 , ["Program sonlandi.",13,10]
       end
   end select
GoTo loop


Title: Re: cant communicate pc to pic
Post by: 3d_man on August 16, 2007, 09:56:42 09:56
first verify from your hardware connection and correct COM# then write simple code to show hardware good


TRISC = %00000000
serout portc.6 , T2400 , ["HELLO "]

 ;)


Title: Re: cant communicate pc to pic
Post by: Ikaros on August 31, 2007, 10:27:36 10:27
The program just wait one character and then ends. May be is better to make a loop to continually read the Serial Input?

Also are you sure about your hardware connections?


Title: Re: cant communicate pc to pic
Post by: Ret12_12 on August 31, 2007, 07:43:59 19:43
If you try case 1 instead of "1" also proton you said  DEC serindata .....

You can have RS232 com. without have the MAX232
SerOut PORTB.0 , 16780 , ["1-PORTA.0 Yuksek Yap ",13,10]  ' transmite to 2400 with a serious res 1k to pin 2 in pc side (9 pin)


Title: Re: cant communicate pc to pic
Post by: mcr on August 31, 2007, 09:34:22 21:34
this serin doesnt work.I use max232 and get the characters on hyperterminal but cant on led.
please help.


T2400 con 0
serindata var byte

SerOut PORTB.0 , T2400 , ["1-PORTA.0 Yuksek Yap ",13,10]
SerOut PORTB.0 , T2400 , ["2-PORTA.0 Dusuk Yap",13,10]
SerOut PORTB.0 , T2400 , ["3-Program Sonu",13,10]

loop:
 SerIn PORTB.1 , T2400 , [serindata]
    select case serindata
       case "1"
       high PORTA.0
       case "2"
       low PORTA.0
       case "3"
       serout PORTB.0 , T2400 , ["Program sonlandi.",13,10]
       end  
   end select
GoTo loop



Remove the END there, that might help.


Title: Re: cant communicate pc to pic
Post by: Rahos on September 01, 2007, 05:45:27 05:45
Use Serout2/Serin2 and direct connection to pic ( not with MAX232)




Title: Re: cant communicate pc to pic
Post by: mcr on September 01, 2007, 05:08:06 17:08
Use Serout2/Serin2 and direct connection to pic ( not with MAX232)


Forgot about that  :-[

But still, If you use a MAX232 the information should be displayed, does not matter if it's correct or not.


Title: Re: cant communicate pc to pic
Post by: Rego on September 01, 2007, 05:12:02 17:12
yea ,i think the error is from that (end)


Title: Re: cant communicate pc to pic
Post by: hsny on September 03, 2007, 03:52:14 15:52
Thank you for all.
I change
T2400 con 0 with include "modedefs.bas"
serin portb.1,T2400,[serindata] with serin portb.1,T2400,serindata

I use 16f84,max232
pic pin7 - max232 pin 9  -  max232 pin8 -  dbp pin 3
pic pin6 - max232 pin 10 - max232 pin7  - db9 pin 2
pic pin17-led

I coludnt high or low led on hyperterminal.I get characters on pc side however.So I used a program named terminal.
Then its ok.