HSEROUT Timing

sodeaf

Senior Member
Hey guys, quick question

I am using HSEROUT to send 200 Bytes in one string to a serial printer.

Using Hsersetup B19200_64, %000

I was wondering if the time between each byte sent can be adjusted. Right now its .108ms, i would like to get it down to 54us.. Is this at all possible.. I have played with different combinations of baud rate vs clock speed, and managed to get the space down to 52us, but unfortunately I think the over all baud rate was 38600 or so to achieve this which would not work. The printer is pre set to 19200.



Thanks in advance..

Steve
 

hippy

Ex-Staff (retired)
I suspect you are stuck with what you are getting and it's a limitation of the firmware.
 

sodeaf

Senior Member
Well I guess it is what it is...

Doesn't hurt to ask.. Nor do I know if that's the issue I am having.. But it could be. I have the printer working fine with the PC, and the code that is being sent via RS232 computer to Printer works fine, Space between bytes is 54us, If i try and copy this data into the Picaxe and send, no luck, strings of code are identical. (yes using the proper RS232 interface) I have the printer communicating with Picaxe back and forth in regards to its status, paper level and so on, but the TX string to poll printer is only 4 Bytes, vs 200. So what I am thinking is when I send the address byte, then the next byte which is the byte to signify to the printer how many bytes I'm sending in total.. followed by the information.. overall this string is taking 100 ms longer then the printer likes.. or compared to the PC, the printer wont even acknowledge the string of code.. Is it possible this could be the case? would a 50us additional delay between byes cause something not even to acknowledge. ?? I have been playing the 20x2 with RS232 for a couple years and never had anything so picky.

Thanks

Steve
 

nick12ab

Senior Member
...(yes using the proper RS232 interface)...
What's a 'proper' RS232 interface?

Are you using different cables to connect the printer to the computer and PICAXE? One may be a crossover cable (usually with identical connector genders on both ends) so check you have RX and TX the right way round.
 

hippy

Ex-Staff (retired)
Inter-byte gap lengths should not matter much to a serial printer so it seems unlikely that would cause problems. It would be worth posting your code and interface circuit.
 

rossko57

Senior Member
There is talk of sending address bytes, then count bytes ... this all sounds a bit like Modbus-RTU protocol or something like?? Modbus-RTU does indeed specify maximum inter-character gaps - a mere 1.5 x normal byte time. That's not very long at all. Many devices don't implement it that strictly, and sometimes it is configurable.
Knowing more about the printer may help clarify what is needed here.

I think that on an X2 chip you might have success by assembling the complete string to be sent in the scratchpad, then sending by HSEROUT in one burp.
 

hippy

Ex-Staff (retired)
There is talk of sending address bytes, then count bytes ... this all sounds a bit like Modbus-RTU protocol or something like??
Could be; so some clarification would help. I looked up Modbus-RTU and that brought up an issue I hadn't thought about; parity bit. Could it be a parity issue rather than an inter-byte timing issue ?
 

westaust55

Moderator
Or even a need for two stop bits?
Unknown in the absence of further information.

I am currently working on a project to interface with a command station via RS485 and the protocol involves 8N+2stop
So I am grateful for the inter yet pauses (using 20X2 at 64 MHz).
At 9600 baud the ~108 usec inter-byte gap is equal to 1 bit in duration.

Also found that the time transition between a Hserin to a Hserout appears too long whereas Serin to Serout works okay in my application where the sequence is:
Wait for a given byte
Send 2 bytes within a given time
Receive a further byte
Respond/act upon the second byte
 
Top