Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RS232 Communication

Status
Not open for further replies.

zonk

New Member
I am using Flowcode with development board to try and create a binary 8bit serial communication protocol to control a video multiplexer via rs232. I cannot create a delay time less than 1 millisecond so that I can create bit legths of 104 microseconds. 8 bit legths in one byte with start/stop bits at either end.
Just to let you Know what I am trying to do.
I can control video multiplexer very easily from a pc using rs 232 but I would like a standalone one button push control to send one byte of info to video multiplexor without the pc. I thought that a pic chip would do the job nicely.
Please Help.
 
zonk said:
I am using Flowcode with development board to try and create a binary 8bit serial communication protocol to control a video multiplexer via rs232. I cannot create a delay time less than 1 millisecond so that I can create bit legths of 104 microseconds. 8 bit legths in one byte with start/stop bits at either end.
Just to let you Know what I am trying to do.
I can control video multiplexer very easily from a pc using rs 232 but I would like a standalone one button push control to send one byte of info to video multiplexor without the pc. I thought that a pic chip would do the job nicely.
Please Help.

A PIC will do it VERY easily, check my tutorials which contain all you need!, and the serial routines are written to use 9600 baud as you require.

Don't know what 'Flowcode' is, but it doesn't sound very useful!.
 
Rs232

Thanks for the reply regarding rs232 control.
I have looked at various assembly codes for controlling rs232 devices other than a pc with a pic chip but they seem to be mostly projects that relay keyboard commands back to the pc through hyperterminal (for example) for test routines.
I have read about bit bashing and other terminologies but still am confused.
My pic programming knowledge is extremely limited. I know how to burn them and use them for novelty led flashing etc.
Could you recommend Pic type for usart usage and how to go about storing 8 bytes of binary info into a pic chip so that a reset or power up routine of the pic chip would send this data to the specified device via rs232 at 9600 bps.
Using software terminal programmes I can either send 8 bytes of binary or 4 bites of hexadecimal or even ascii codes to my device and make it work but I am presuming rightly or wrongly that the decimal bytes are easier to send?
If at worst, I can get around my problem by hard wiring the necessary switches of my device to a remote panel but dont really want to.
Any advice would be appreciated
 
zonk said:
Thanks for the reply regarding rs232 control.
I have looked at various assembly codes for controlling rs232 devices other than a pc with a pic chip but they seem to be mostly projects that relay keyboard commands back to the pc through hyperterminal (for example) for test routines.
I have read about bit bashing and other terminologies but still am confused.
My pic programming knowledge is extremely limited. I know how to burn them and use them for novelty led flashing etc.
Could you recommend Pic type for usart usage and how to go about storing 8 bytes of binary info into a pic chip so that a reset or power up routine of the pic chip would send this data to the specified device via rs232 at 9600 bps.

As I said, check my tutorials, specifically 7.1 and 7.2, 7.1 sends 5 characters out as RS232 (but is obviously easily extended), and 7.2 sends a string stored as a table, which is even easier to change to what you want.

A 16F628 is used in most of the tutorials and would be fine, and requires no changes except the data you want to send. With just slight changes you could do it with an 8 pin PIC like the 12F675.

Using software terminal programmes I can either send 8 bytes of binary or 4 bites of hexadecimal or even ascii codes to my device and make it work but I am presuming rightly or wrongly that the decimal bytes are easier to send?

Makes no difference, micro-controllers only speak binary (as do computers), so everything is binary anyway - decimal, hexa-decimal or ASCII are just conventions to make it easier for humans. In PIC assembler you simply tell it what base the data is in, and the assembler converts it during assembly.
 
Rs232

Thanks very much indeed for your swift reply.
Just a quick question, bearing in mind my programming knowledge is poor.
In tutorial 7.2 would I just change
retlw 'W'
retlw 'i'
retlw 'n'
retlw 'P'
retlw 'i'
retlw 'c'
retlw 'P'
retlw 'r'
retlw 'o'
retlw 'g'
retlw 0x0A
retlw 0x0D
to
retlw '0'
retlw '0'
retlw '0'
retlw '0'
retlw '0'
retlw '1'
retlw '0'
retlw '0'
retlw 0x0A
retlw 0x0D
if I wanted to send binary bit 00000100 at 9600 baud.
if I wanted to send another 3 strings of 8 bit binary to complete the command for my serial device would I just add another bunch of 10 retw commands.
If I wanted to use alternate pic12f675 is it the header info to be changed
Sorry if I sound a dunce but still learning.
I am quite keen on learning pic programming proper.
Are there any training schools or seminars to make it easier, can you recommend?
Looking forward to reply
 
That's only a single byte, you would just need:

retlw b'00000100'

To send it as a single byte, if you wanted to send it a bit at a time as ASCII characters you would do as you did above. It all depends on exactly what the device requires, you should know that from the working PC system.
 
PIC for ASCII to RS232

I want to build a simple (and cheap) box that has 4 momentary push buttons. Each button sends a predetermined 5 ascii character code (as binary) thru the RS232 port at 9600-8N-1. Each byte must consist of 10 bits (start, 8 information, stop).
I figure I should be able to do this with a PIC and a TTL / RS232 converter.

Can anyone suggest how to do this and what kind of PIC to use?
 
I want to build a simple (and cheap) box that has 4 momentary push buttons. Each button sends a predetermined 5 ascii character code (as binary) thru the RS232 port at 9600-8N-1. Each byte must consist of 10 bits (start, 8 information, stop).
I figure I should be able to do this with a PIC and a TTL / RS232 converter.

Can anyone suggest how to do this and what kind of PIC to use?

You have a good clear definition of what you want to do and also what hardware you need to have to accomplish it.

What you apparently lack is the programming knowledge to tie those two things together. Rather then jumping to your final application you might consider just concentrating on learning how to program a PIC or other micro and the needed commands for your application program will become clear to you as you learn a programming language. That or pay someone to write the program for you.

Virtually any microprocessor chip could be programmed to accomplish this simple task. One with a built in serial UART would make the programming a little simpler but again it would be hard to select a micro that could not accomplish this task.

Lefty
 
Last edited:
PIC for ASCII to RS232

Lefty and Blue,

Thanks for your reply. The only PIC programming experience I have is from 8 yrs ago programming a 16C58 to send a morse code callsign (very simple), using a borrowed burner/software.

I was hoping for a target PIC (thanks Blue) and some guidance as to proceed (thanks Lefty). I didn't expect to get to burning immediately, just a place to start. I think I'll pick the one suggested by Blue and start studying the command set, software / burner availablility and see what tutorials are available.:p. THANKS.
 
For a few pennies more the 16F88 has A/D and the Debug mode. Handy for troubleshooting if you have a debugger / programmer (ICD2, PK2, Junebug)
 
Status
Not open for further replies.

Latest threads

Back
Top