November 21, 2024, 12:22:32 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


SERIN SEROUT limits?

Started by KISTech, October 14, 2010, 06:50:07 PM

Previous topic - Next topic

KISTech

For some reason when receiving byte data using SERIN I can't receive a value higher than 127.

I double checked and I'm using 2400 baud, No Parity, 8 data bits, 1 stop bit.

When I send a 128 to the PC, I receive a 63.

Also, if I try and send a 0 I don't get anything, whether it's on the Prop-2 side or the PC side.

bsnut

I would suggest you to look at the Help file in Basic Stamp Editor, it should give you the info that you need for SERIN and SEROUT instructions. One of the things you can try is, changing this

2400 baud, No Parity, 8 data bits, 1 stop bit

to this

9600 baud, No Parity, 8 data bits, 1 stop bit

Both should work, but right now I am at work and not at my laptop were my Stamp Editor is running on. 
William Stefan
The Basic Stamp Nut

JonnyMac

It's something on your PC side.  I've written VB programs that upload/download all values to a BS2 (processor in Prop-2) many times.
Jon McPhalen
EFX-TEK Hollywood Office

KISTech

I think you're right. I did some testing with the plugin I'm using in the app I'm writing, and it's the culprit. It ignores 0 value bytes, and seems to have been written only to handle ASCII text for terminal emulation.

Thanks.

KISTech

I have it working much better now using a different library that allows full byte binary data.

I'm having one issue though. I'm using the following line on the Prop-2 to receive 4 bytes.

SERIN 16, 16780, 500, Cont, [C0, C1, C2, C3]

I'm sending it the following bytes,

255, 32, 32, 0

It seems to be ignoring the 0 on the end, and C3 ends up being 32.

Can the Prop-2 not receive a value of 0 in a byte?

JonnyMac

Let me try this again.... it's not the Prop-2.  The BS2 processor has been around a long time (10+ years) and many of us have created commercial applications with it that required serial communications (of any value).

Perhaps there's something in this article that will help you:
-- http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol3/col/nv89.pdf

Do keep in mind that anything you send to the programming port (pin 16) gets echoed back by the hardware so your PC side has to filter that out.
Jon McPhalen
EFX-TEK Hollywood Office

KISTech

Just following the logic where it takes me. :)

Thanks for that additional info. I should have this worked out shortly. (it's soooo close.)


JonnyMac

What are you using on the PC side to talk to the Prop-2?
Jon McPhalen
EFX-TEK Hollywood Office

KISTech

October 15, 2010, 03:25:39 PM #8 Last Edit: October 15, 2010, 04:08:38 PM by KISTech
DarkBASIC Professional http://www.thegamecreators.com

Calling the COM port functions in Kernel32.dll

It's a videogame/application rapid development environment. It's fairly fast and very versatile.


KISTech

I managed to get it figured out enough that it's working. There's no flow control, so putting small 2ms pauses between bytes sent helped.
It also helped to cut the data I'm sending back and forth down to just 2 bytes. A command byte, and a data byte.

Whether it's the Prop-2 or the Microsoft COM port driver I don't know, but I was able to verify that I cannot receive a byte with a 0 value from the Prop-2.
I verified this by sending the byte values 32 32 0 and 32 0 32. Both times 32 32 was echoed back.

I managed to work around that for this application, so I'm not going to worry about it for now.

When this is all done I'll post the code in the appropriate forum area.


JonnyMac

I have to keep saying this because I don't want any other customer accidentally misled by your post: the BS2 (Prop-2) has no problem receiving a zero byte.  I've done it.  Lots of times. 

As I like programming languages I bought that compiler and, for the moment, anyway, I'm wishing I could get my $40 back.  I will come up with a little VB app (need to install on new computer) that demonstrates serial comms with the Prop-2.
Jon McPhalen
EFX-TEK Hollywood Office

KISTech

Ok. I'm sure it's just the settings in the Microsoft dll that are causing that issue then. I've tried it with fNull set on or off, but it doesn't seem to change anything.

DarkBASIC Pro is a little confusing at first, but once you wrap your head around it's little oddities it's pretty darn good. You can check out the game I'm working on at http://www.worldsapartonline.net. It's written completely in DBPro.

Also, there should have been mention on the site that DarkBASIC Pro is FREE to try, and you only have to buy the license if you're going to produce a commercial product with it. Ask them via email for a refund. They're pretty good about doing that with little fuss. Give them a few days to respond though. They're in the UK.

I like programming languages too, and have several currently installed. I picked DBPro because it's fast and easy and I'll be able to add 3D graphics to the application later.

Anyway, I appreciate the help. I'm getting this ready to run our haunted house this year. Lots to do still...

KISTech

What I ended up with for our Haunted House was making it so the PC only received status information from the Prop-2.

I set up the Prop-2 to do all the show work, and just had it send a byte to the PC to indicate which sensors were being tripped.

Based on which sensor was tripped, I had the PC play a specific sound over the speakers hanging in the rafters over the haunt.

It worked pretty well, except when the actors kept tripping the sensors. So I'll have to redesign the haunt for next year with specific spots for them, and better training to keep them from setting things off prematurely.