PDA

View Full Version : PicBasic Pro and SEROUT hex problem



mark30504
- 18th November 2010, 18:07
Hello

Hope someone has a easy answer.. seems like there should be one...

I am useing PicBasic Pro and Pic 16F886

Useing SEROUT

SEROUT2 PORTC.6, 84,[$80,$02E0,$01]

I am trying to send out Hex 80, 2E0, 1

The 80 and the 1 works fine.

the $02E0 is being shorting to E0 and sent

so instead of haveing a decimal equivenlent of 736 for $02e0
I have 224 or $E0

tried HEX $02E0
tried IHEX $02E0
tried HEX 02E0
tried HEX 2EO

All of the above generate errors

Thanks for any help

Dave
- 18th November 2010, 18:42
mark30504, You are trying to send a combination that is bigger than a byte (0-255). Just send it as 2 individual bytes bytes like: SEROUT2 PORTC.6, 84,[$80,$02,$E0,$01]. Or you could if you have the decimal equivelents available send the string: SEROUT2 PORTC.6, 84,[HEX2 first byte variable,HEX4 second word variable,HEX2 third byte variable]

Dave Purola,
N8NTA

mark30504
- 18th November 2010, 19:58
Hello

Thanks

Useing our first example

SEROUT2 PORTC.6, 84,[$80,$02,$E0,$00]

it gave me no errors but it does not seem to have the serial output I need

The device I am hooking the Pic to requires data formatted

$80,$02e0, $00 where 80 is a command to store date, the memory location is 2e0 hex and the data is 0 in this case.

When I brake up the 02e0, on serial channel receives 80,2,E0,0

in dec it should look like 128,736,0

it now looks like 128,2,224,0

It may work but currently my receiveing device does not seem to be storeing the data correctly...

Any other thoughs ? the comma , seems to be somewhat the problem, can put $04$E0 together without fault

Dave
- 19th November 2010, 11:32
mark30504 , It sounds like the device you are trying to send to requires ascii data, am I right? If so, just send the characters you want to send like so: SEROUT2 PORTC.6, 84,["80,2E0,00"]. If you notice I'm sending the comma's between the characters. Maybe if you could explain exactly what the device requires for the data stream... It is kind of hard to diagnose the and give a proper answer with the amount of data you have given.

Dave Purola,