PDA

View Full Version : Need Help~~ simple serout and serin command, but i receive unknown character in PC



mengckid
- 3rd September 2005, 18:37
Need Help~~ I write the simple serout and serin command in PIC Basic Pro, but i receive unknown character(like chinese words or ???? things) in my PC, can anyone tell me, how to solve it, thanks u~~

I am try many ways to solve it,but still cant solve it :(

I am using PIC 16F874A model, try a simple coe below:


serout PORTC.6,T2400,["ABCDE"] 'Display menu on PC screen
PAUSE 2000

main:

PORTB.0=0
i = 0
SERIN PORTC.7,T2400,["A"],waikong
serout PORTC.6,T2400,[waikong] 'Display menu on PC screen
PORTB.0=1

goto main



output receive in PC : unknown character like chinese word or ????

after i type a word "A" then type send...the led cannot turn on, and i need to disconnect my power supply, and reconnect it again...to see the led light on and off. How could be??

really need a help~~thanks u...

mister_e
- 3rd September 2005, 19:52
i don't see any INCLUDE "MODEDEFS.BAS" and/or DEFINE OSC x so what about ...
SEROUT PORTC.6,0,["HELLO"]

NO?? what about now
SEROUT PORTC.6,4,["HELLO"]

Since this PIC have an internal USART, why you don't use it??? HSEROUT, HSERIN + an external inverter circuit like MAX232.

Bob_W
- 5th September 2005, 03:05
Since this PIC have an internal USART, why you don't use it??? HSEROUT, HSERIN + an external inverter circuit like MAX232.

Assuming you have all the includes, etc. You must already have an external inverter, because you're using T2400. If you don't, that might be when you're getting trash. Also, assuming the LED is on PORTB.0, the LED will turn back off as soon as it turns on because you set the port low immediately making it high.

mengckid
- 7th September 2005, 06:48
i don't see any INCLUDE "MODEDEFS.BAS" and/or DEFINE OSC x so what about ...
SEROUT PORTC.6,0,["HELLO"]

NO?? what about now
SEROUT PORTC.6,4,["HELLO"]

Since this PIC have an internal USART, why you don't use it??? HSEROUT, HSERIN + an external inverter circuit like MAX232.

ya..i got include the INCLUDE "MODEDEFS.BAS" and define osc X..in my code. I haven try PIC 16F84A, but i think should be nope problem with the code that i mention above...thats y i am thinking is it PIC 16F874A problem? by using simple serin and serout command...

By the way, i got include external inverter circuit like MAX232 in my hardware...emmm, just panic now, but i am sure my connection is correct...just receive the weird character only...

emm..hehe, can u send me the simple code with HSERIN and HSEROUT to test...hopefully, can settle soon...:(

Ioannis
- 7th September 2005, 14:11
I am sure that with Hserout you will have no problem. Try to set the output BEFORE using the Serout command.

Ioannis