PDA

View Full Version : MOBO BS2pe micro-controller



Javed
02-12-2010, 05:30 AM
Hi,

I am communicating with a MOBO BS2pe micro-controller. I input through pin 5 and output pin 16. When I type one letter twice I am getting to different letter. I have also placed the ASCII value in the debug screen to show the letter are not the same. Here is the code



' {$STAMP BS2pe}
Loop:
serData VAR Byte
serData = 0
DEBUG ? serData
SERIN 5, 16468, [serData]
DEBUG "Command Input: ", STR serData, CR
DEBUG "Command Input: ", DEC serData, CR
GOTO Loop


I get ASCII number 65 and 193 as the output. However, I am only pressing the A on the other keyboard.

Post Edited By Moderator (Joshua Donelson (Parallax)) : 2/12/2010 12:41:46 AM GMT

davejames
02-12-2010, 05:42 AM
Javed,

First, I'd put the "serData VAR Byte" line before the "Loop:" so it's not always re-declared.

Second, what's the reason for using STR? It looks for an ASCII string and you're only looking for one character.


Regards,

DJ

P.S. please edit your original post and include a subject line.



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Javed
02-12-2010, 06:01 AM
Hi DJ,

Thanks for the tips. There was reason for using STR.

Were you able to duplicate the issue. I made those corrections and still found the same toggling error.

davejames
02-12-2010, 08:03 AM
Hi Javed,

I won't be able to duplicate the issue as I don't have a MOBO and not able to use pins 5/16 for serial i/o.

One other thing...the compiler directive like "{$PBASIC 2.5}" is missing. Did you leave it out of the example or is it missing from your actual code?

DJ

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

JD
02-12-2010, 09:12 AM
Javed,

Can you try the program attached to see if you can read in from the standard serial port on PIN 16? I was able to get the same value of 65 for "A" everytime, the other·A is an extended character, so I'm not sure where that is coming from.

Please let me know of your results.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

Javed
02-12-2010, 09:58 AM
Hi Josh,

Thanks for the reply! When I use pin 16 there are no issues on my computer either. However, when I input through an I/O pin, I get the a toggling character. The hyperterminal I am using on the other computer is setup properly, but for some reason, the characters can not be type consecutively. If I however, type different letters each time, then life is good and what I type on one computer I see exactly on the other.

Bests,

Javed

davejames
02-13-2010, 12:29 AM
SEROUT/SERIN with HyperTerm...

If SEROUT/SERIN are used in their simple form ,·i.e. no "flow control", make sure HyperTerm flow control is set to "none".

HyperTerm's flow control setting can be found:

File -> Properties -> Connect To -> Configure -> Port Settings -> Flow Control (Hardware, Xon/Xoff, None)


Regards,

DJ

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Javed
02-13-2010, 03:18 AM
Hi Dave,



Thanks for the reply. Yes I have hyperterminal set at 2400 or 9600 baud rate 8, N, 1, None.

I was able to get the degug output error to stop. My suspisions are that the basic stamp is working properly and not software related. I have a custom connection betweem the RS232 and TTL between the computer and I/O pin I am using. After some efforts yesterday, I was able to type the same letter consecutively and not having any issue. Thank you again for you help in resolving the issue.





Bests,



Javed

davejames
02-13-2010, 04:06 AM
...you're welcome!

DJ

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔