Page 1 of 1

Connecting RS-232

Posted: Tue Feb 05, 2008 4:06 pm
by andy20989
Hey Guys,

I have another problem- basically im trying to control a motor controller using a simplifier serial rs-232- which is uses TTL level single byte serial commands to set the motor speed and direction. It is one direction only.

First of all which pin is the default connection on an 18F4455 dil chip?

can you give me some example code to send '127' to the motor please?

Also on the expert configuration screen what should i select / disable? I am using a 4mhz crystal.

Many Thanks,


Andy

Re: Connecting RS-232

Posted: Tue Feb 05, 2008 4:40 pm
by Benj
Hello Andy

The Transmit pin of the 18F4455 is RC6 or pin 25 it is marked with a TX.

An example of sending 127 would be to include the RS232 component into your program and then using a hardware macro send RS232 byte and in the parameter input place 127 or the variable holding 127. You will have to go into the RS232 component properties to set the baud rate and flow control. Also make sure the clock speed in Flowcode is correct for your crystal.

Expert Config Screen example.
Clk source OSC1/OSC2 - Clock from Crystal
div by 4 - Normal 1:4 operation
no divide - No effect in crystal mode
XT-USB:XT - for a 4MHz crystal or below / HS-USB:HS for a higher value
PortB configured as digital I/O - Starts PortB as digital I/O
MCLR Enabled - Enables the reset pin
Everything else disabled (especially watchdog timer)

Hope this helps.

Re: Connecting RS-232

Posted: Tue Feb 05, 2008 5:40 pm
by andy20989
I'll have a bash and let you know tomorrow :-)

Re: Connecting RS-232

Posted: Sun Feb 24, 2008 10:35 pm
by alain31
Hi MatrixMultimedia team,

I've got another RS232 problem ...
I recently purchased FlowCode, because of my poor software programming skills, Flowcode sound a lot easier.
However, to debug my programs, which run on a PIC16F877A CPU board that I built, I use the RS232 trhough a MAX232 connected to my PC and displayed via TeraTermpro. After a few tests and having read all RS232 posts on this forum, I am unable to display a single character on y screen.
My hardware is working, I tested it back with a little C software and simple "printf" command. But with flowcode, the only character displayed is a + upon a minus sign. RX is connected to RTS pin7 and TX to CTS pin6 of Port C on the RS232 Flowcode component, both sides at 9600 Bds.

I saw also on this^post that you refer to "Expert Config Screen", where can I find this screen, didn't see it ? Could it help ?

Alain

Re: Connecting RS-232

Posted: Mon Feb 25, 2008 9:50 am
by Benj
Hello

The expert config screen is available from the Chip -> Configure menu of flowcode.

Make sure that your clock speed is correct in Flowcode and that you are using the XTAL or HS mode of operation.

Re: Connecting RS-232

Posted: Mon Feb 25, 2008 9:39 pm
by alain31
Thanks Benj for the answer,I understand that the expert configuration screen is from PPP software.
Unfortunatly, the 16F877 on which I try to load my programm is on a developpment board I built. And you know what, I have only the serial port to upload my program. And it seems to me that PPP has been designed to load software through parallel port or USB. Am I right ?
Is there any way to use serial port anyway ? Or Can I use a USB-RS232 adaptater ?

At the moment, I am able to load my software using a bootloader and RS232, but it seems I miss all the configuration bits.
Thanks for your answer

Alain

Re: Connecting RS-232

Posted: Tue Feb 26, 2008 10:45 am
by Benj
Hello Alain

You can still use your programming software. PPP actually embedds the config information into the hex file so as long as the chip is configured correctly in Flowcode the hex file should be alright to send using your programming software.

The adapters you mentioned sound like they would be more trouble then they are worth.

Re: Connecting RS-232

Posted: Wed Feb 27, 2008 9:06 am
by alain31
Right Benj,
So I have to put the configuration into an additionnal C code control box ?
Actually I tried last night, but every time, what I've got was a compiling failure from C to asm :
D:\Matrix Multimedia\Flowcode V3\Exemples 16F877\TUT_09_printf.c(303): error: missing semicolon
D:\Matrix Multimedia\Flowcode V3\Exemples 16F877\TUT_09_printf.c(303): error: failure


An the code itself in the box :
/*Entrer le code C après ces commentaires
Par ailleurs, pour entrer du code assembleur,
utiliser l'opΓ©rateur asm devant chaque instruction, par exemple
asm movlw 5
ou imbriquer plusieurs instructions dans un bloc asm comme ci-dessous :
asm
{
movl
Rem Configuration for PIC16F874A */
#pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF


Any idea of what i did wrong ?
Thanks.
Alain

Re: Connecting RS-232

Posted: Wed Feb 27, 2008 12:51 pm
by Benj
Hello Alain

You do not have to code the configuration yourself. If you use the PPP tool from Chip -> Configure inside Flowcode then this information will be passed into the hex file upon compilation.

Re: Connecting RS-232

Posted: Wed Feb 27, 2008 10:04 pm
by alain31
Thanks Benj,
Finally, after a couple of bad results, everything's clear, uploading ok, with the right configuration, and RS232 working well.
At last, the mess I did was due to the fact that my PPP setting did not stand while doing all the tests. I should have check that, but you know ...
Well, now, the right things will begin. I keep you inform, just for the fun.
Alain