serin is truncating serout

erdc

Member
When I have this code;

---------
loop:
pause 250
serout 7,T2400,("What Number?",13,10)
goto loop
---------
It dispalys "What Number?

But with this code,
---------------
loop:
pause 250
serout 7,T2400,("What Number?",13,10)
pause 250
serin 0,T2400,b5
goto loop
---------------

I get "ber?"
 

ljg

New Member
a bit mor info
1) what Picaxe are you using?

2) What device are you comnunicating with?

3) what code does that device use to return a result?

4)What task are you trying to accomplish?
 

ljg

New Member
oh yeah,

I forgot the two most important questions

5) what's the purpose of the Pause statement?

6) what happens if you make it Pause 240?
 

erdc

Member
1) 28x

2) PC via Hyper terminal

3) Via PC Keyboard

4) Two way communication

5) To pause between serin and serout. I know it is good thing to do for infra communication.

6) It will pause for 240 milliseconds

I kept the post short, since I know it is just a coding issue. All that has changed was adding the serin command into it, and that was after the serout command that worked at first fine.What I am going to do with it is not really the issue. For now I just want to make two way communications via RS232. All though at the end it will control my full automated homebrew system. A man can never have too many good (and tasty) hobbies.
 

ljg

New Member
I think the key is the Pause statement between your serout and serin statements. If you make the Pause value smaller or getting rid of it, you might capture the first part of "What Number?". I suspect you might still be in your pause while the transmission is started.


I'm not sure how you are trying to receive infrared with the Serin command, so I can't help you there, but if Hypeterminal is just echoing back, you will probably always lose some of the retransmission. it takes time for the Picaxe interpreter to set up the serin command. Try sending some blank characters like " What Number?". or setting the hyperterminal preferences for a delay at each line end.
 

hippy

Technical Support
Staff member
I can't see any reason the code shouldn't conceptually work, but would suggest you try it with the Programming Editor Terminal window to take out any HyperTerminal problems there may be.

How are you interfacing to the PICAXE ? If it's not through a MAX232-style interface, the baud rates ought to be N2400, but as you get something I presume you have a MAX232, in which case, a "HIGH 7" at the start of the program may solve the problem.

Are you using a separate TX and RX line, or is there some complex configuration ? Check you don't have any accidental shorts between the two.

Edited by - hippy on 18/06/2006 21:30:46
 
Top