PDA

View Full Version : RS232 7-E-2?? Driving a BetaBrite



Eeyore
- 10th September 2008, 20:56
I have spent some time learning the BetaBrite protocol to drive the display using serial commands. Unfortunately the Model I have (the popular 1036) has a serial port that is fixed at 7-E-2 (two stop bits), 9600 baud. I am unable to find any code that will let me configure a Pic to those serial settings. Any suggestions on how to interface with the Betabrite. The application is a simple counter. Every time a push button is depressed, I want the Betabrite to display "That's 1" then "That's 2" Etc. Looking around, the closest thing I found was a function routine written for the DiosPro that follows. I do not know how to convert this to work with a PIC, nor do I want to start working with a whole new compiler and hardware. Any thoughts would be appreciated.

Here is the DiosPro code:

'-----------------------------------------------------------
'Send a byte of data at 9600 7e2
'-----------------------------------------------------------
func sendchar7e(port,dat)
dim x,b
dim ep
ep = 0
for x = 0 to 6
if dat.bit(x) = 1 then
ep = ep + 1
endif
next
dat.bit(7) = ep.bit(0)

skimask
- 10th September 2008, 22:55
nor do I want to start working with a whole new compiler and hardware
Which compiler and hardware are you using now?

mackrackit
- 10th September 2008, 23:52
Maybe you should try
http://forum.crustcrawler.com/phpBB3/

Or get Pic Basic and hang around here.

skimask
- 11th September 2008, 00:15
Maybe you should try
http://forum.crustcrawler.com/phpBB3/

That DIOSPRO chip's specifications look real familiar...
Where have I seen those spec's before?
I can't quite put my finger on it...

Eeyore
- 11th September 2008, 01:00
Skimask
I am using PicBasicPro 2.50A, and can use any of the Pic Procs (non surface mount). I have been testing with a 16F876A, but only because it is in my breadboard all set up. As you point out in your second post, I assume that the Dios product is based on the pic, so if they can do it with a Dios, we could do it with a Pic, but I think there might be an limitation with the PBPro.

Mackrackit,
Unsure why you could not follow my original post, but it seems clear that am I writing code for a PIC (in the PBP forum). Are you not able to follow the reasoning behind my inclusion of the Dios example?

mackrackit
- 11th September 2008, 01:49
Mackrackit,
Unsure why you could not follow my original post, but it seems clear that am I writing code for a PIC (in the PBP forum). Are you not able to follow the reasoning behind my inclusion of the Dios example?
I guess you are just to smart for me. First time poster post code for another compiler and states they do not want to learn anything else. I do not know what I was thinking :)

All you had to do was ask. How do I do 7E2 at 9600?

First set the define for SEROUT2


DEFINE SER2_BITS 9
That should give a false bit.
Then to get the 7E, use the mode number 24660.

You may want to check the manual on this. And if you are using the hardware port you will have to check the data sheet for your PIC.

BTW... Welcome to the forum.

skimask
- 11th September 2008, 02:33
I guess you are just to smart for me. First time poster post code for another compiler and states they do not want to learn anything else. I do not know what I was thinking :)
Same thoughts going on here...
This situation is atypical... Surely not the norm for a first time post.

Eeyore
- 11th September 2008, 03:55
Sorry if I got off on the wrong foot, but I thought your initial reply was being sarcastic (thought I was being told where to go, literally). Now that I see your reasoning, I understand that I misinterpreted your comment.

Thank you for the suggestion, I will try it over the weekend

skimask
- 11th September 2008, 04:01
Sorry if I got off on the wrong foot, but I thought your initial reply was being sarcastic (thought I was being told where to go, literally). Now that I see your reasoning, I understand that I misinterpreted your comment.

Thank you for the suggestion, I will try it over the weekend

Oh...don't worry...it was sarcastic!
Like I said, most 1st posts go something like this:
I can't blah-blah-blah...
Well, have you tried blah-blah-blah
Can you teach me how to blah-blah-blah
Have you got the manual for blah-blah-blah
There's a manual for blah-blah-blah?
Der-der-der-der...

mackrackit
- 11th September 2008, 04:03
but I thought your initial reply was being sarcastic
We are good at sarcasm too :D

Like I said check the manual about the 2 stop bits. I have not needed to do that but in theory...

Let us know how it goes.

Archangel
- 11th September 2008, 08:21
" THE BOOK " Says, for an instance . . . "It should only be used if parity is selected (bit 13 = 1) . . . . and several other instances of defineing individual bits . . . is there a register that can be addressed directly like the Tris or INTCON registers ? I mean indirectly there is for the lower 12 bits by using the appropriate " MODE" settings, but is there a register you can set manualy ?

mackrackit
- 11th September 2008, 10:34
Joe,
I read somewhere from one of the gurus about having 2 stop bits. They were setting a register using the hardware port, I can not remember whitch one though, to 9 bits and the 9th acting as a false bit. So I figure it might work using software serial too?

Archangel
- 11th September 2008, 21:04
Hi Dave, Well that gives me something to do, I will write a short program using serout2 and take the ASM, MAC and list files apart looking for the answer. I figure at the least If I can figure out what those commands do, it might be easier to put asm snippets in than writing endless Defines and hoping it works.
<b>
DEFINE</b> SEROUT2_NON_INTUITIVE = 1

Eeyore
- 18th September 2008, 02:30
Tried the " DEFINE SER2_BITS 9 " over the weekend (already had the mode at 24660). It did not seem to help. Not sure what else to try, but I appreciate the advise.

mackrackit
- 18th September 2008, 09:21
Can you send working commands from the PC using a terminal?(hyperteminal or something like it, not the softeware that comes with the device)

If not, then the problem is elseware. If you can not send with a teminal, get a program that monitors the serial port (google serial sniffer, some are free) and see exactly what is being sent between the device and the standard program for the display.

And what about handshaking?

Again, I am not sure about the two stop bits, but that may not be the whole problem.

mackrackit
- 19th September 2008, 17:50
Are you by chance using a usb to serial converter?

I was just play with the 7E2 thing.
Works with a real serial port, but not with a usb converter. (Belkin F5U409) On the same machine.

Same converter works with 8N1.

Eeyore
- 22nd September 2008, 01:29
No usb-serial. For experimental purposes, I am going out from a preconfigured "ultimate oem" module, which already has the power, serial, reset, and clock set up. I connect it directly to the Betabrites serial port, passing through a null modem and a m-m adapter.

I want to try out your hyperterm suggestion, but there are 2 problems. First it has been so long since I did anything in a terminal emulator, I am not sure I won't mess that up. For example see the following code in Zeus for PC's (I know, I keep introducing other languages, I apologize, but there is so little code on the net for the BetaBrite)
func main()
Const Ch1 1 'Zues Com Channel 1

'Open the ComPort
ComOpen(Ch1,baud=9600,port=1,parity=2,bits=7,stop= 2)

'Tell the Sign we are ready to comunicate
ComOutput Ch1,chr(0)+chr(0)+chr(0)+chr(0)+chr(0)
ComOutput Ch1,chr(1)
ComOutput Ch1,"Z00"

'Send Priority Text Message
ComOutput Ch1,chr(2)+"A0"
ComOutput Ch1,"Nuts and Volts"
ComOutput Ch1,chr(4)

ComClose Ch1

endfunc

How do I send the ASCII chr(0)'s (5th line) as oposed to the Digits, such as the "Z00"(7th line) in Hyperterm? I know it is a real green question, but I don't recall ever having the need.
My second problem is that I am using a usb-serial adapter for communicating with the pc. However I have not run into the same problem you have with this, as I am able to communicate to the Betabrite from a pc with various programs I have found on the Web.

Thanks again for sticking with the post.