PDA

View Full Version : Serial reading of binary at 75 baud



JasonMarsh
- 20th February 2008, 16:03
Hi,

I wonder if anyone may be able to help...

I am using an 18F1320 at 4Mhz and need to read serial binary code at 75 baud. I then need to convert the binary 'back' into Hex to output at a faster rate which is no problem. I can read at 75 baud using a 4MHz crystal by DECLARING it at 16MHz and using SERIN, but then have a problem with the input being in binary....

skimask
- 20th February 2008, 16:13
I am using an 18F1320 at 4Mhz and need to read serial binary code at 75 baud. I then need to convert the binary 'back' into Hex to output at a faster rate which is no problem. I can read at 75 baud using a 4MHz crystal by DECLARING it at 16MHz and using SERIN, but then have a problem with the input being in binary....

Ok, so you're reading numbers in straight binary, as in, you get %01010101 or whatever, and you have to send that out as a 55, as in the hexadecimal representation of 01010101?
If that's the case, it's all in the manual under the SERIN2 command.
If not, well, try again...

JasonMarsh
- 20th February 2008, 17:00
Thanks for the reply Skimask,

Maybe I am missing something here, I cant find a SERIN2 command in the manual. Well, it is found on the back page as a protected word...

You are right in what I have coming in is something like %01010011.


As I understand thing, the following code would not be looking for BIN input, but ASCII? Which can then be represented as required....?

Dim InDat as Byte
Serin2 PORTB.4, 19697, [InDat]

The results printed as HEX are not what I am expecting, I think 00 80 00 00 ???

skimask
- 20th February 2008, 17:27
Maybe I am missing something here, I cant find a SERIN2 command in the manual. Well, it is found on the back page as a protected word...

You are right in what I have coming in is something like %01010011.

As I understand thing, the following code would not be looking for BIN input, but ASCII? Which can then be represented as required....?

Dim InDat as Byte
Serin2 PORTB.4, 19697, [InDat]

The results printed as HEX are not what I am expecting, I think 00 80 00 00 ???

Does the front of the book have the word Proton on it anywhere?
'cause if it does, you're in the wrong forum...

JasonMarsh
- 20th February 2008, 17:34
Hi,

I was starting to think the same! But yes....

Proton Development Suite

I am running Proton+ Basic compiler 3.1.0.9

skimask
- 20th February 2008, 17:36
Hi,

I was starting to think the same! But yes....

Proton Development Suite

I am running Proton+ Basic compiler 3.1.0.9

Well, if you look towards the top of your screen, you may see the words: MELabs PICBASIC Forums