RS232 out and bit bang

Forum for problems or queries regarding Flowcode Comms Components. Eg LIN, I2C, SPI, RS232, CAN, IrDA etc

Moderators: Benj, Mods

User avatar
tanlipseong
Posts: 31
Joined: Thu Aug 27, 2009 3:11 pm
Location: Malaysia
Contact:

RS232 out and bit bang

Postby tanlipseong » Fri Aug 28, 2009 9:21 am

Hi everyone, I am new here, just bought from Farnell "PICKIT2 + Flowcode (Student licence)". After receive the item, then i realize it do not support communication.

I tried the sample program provided by Matrix to bit bang RS232 data out using the PIC16F887 internal oscillator, i get max baud rate of 200 (check with oscilloscope 5mS pulse). i can not get the delay time below 1mS to increase the baud rate unless increase the PIC16F887 clock frequency using external osc.

If i upgrade to Flowcode full version, with internal oscillator of PIC16F887 what is baud rate i can get?

User avatar
tanlipseong
Posts: 31
Joined: Thu Aug 27, 2009 3:11 pm
Location: Malaysia
Contact:

Re: RS232 out and bit bang

Postby tanlipseong » Sat Aug 29, 2009 4:20 pm

ok, have found a forum thread about steps and c code to setting the clock correctly, will try it on next Tuesday.

any way, i decided to upgrade to Flowcode V3 Pro, my current copy is home version comes with PicKit 2 from Farnell, can i upgrade it using the link in Matrix webside? is the cost i see on the link correct?

or do i need to purchase another copy from Farnell?

please help.

User avatar
tanlipseong
Posts: 31
Joined: Thu Aug 27, 2009 3:11 pm
Location: Malaysia
Contact:

Re: RS232 out and bit bang

Postby tanlipseong » Tue Sep 01, 2009 1:48 am

have able to make the the output at 9600 baud with below settings:

1. Internal oscillator at 8MHz (using C code).
2. Chip, clock speed, 710000Hz. (to offset the culculation of 1ms become 0.08875ms)

Although the baud rate is correct now, the delay of 1ms is actually getting a 0.104ms due to the clock speed culculation (some how).

i believe above is not the proper way to do it, please help me on the correct way to do it.

Tq

User avatar
Benj
Matrix Staff
Posts: 14075
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4297 times
Been thanked: 4051 times
Contact:

Re: RS232 out and bit bang

Postby Benj » Thu Sep 03, 2009 8:42 am

Hello

Your delays are so far out because you must set your clock speed in Flowcode to match the speed of your internal oscillator. In your case this would be 8000000. The value you were providing before was 710KHz rather then 8MHz which is why the delays are nearly ten times shorter then they should be.

User avatar
tanlipseong
Posts: 31
Joined: Thu Aug 27, 2009 3:11 pm
Location: Malaysia
Contact:

Re: RS232 out and bit bang

Postby tanlipseong » Thu Sep 03, 2009 12:13 pm

Benj,

have found the C Code for reducing delay time to get 9600 baud, now i can set the chip clock speed properly.

I have ordered (from Farnell) a copy of Flowcode 3 Pro to replace the student version that come with PICKIT2, hope it helps to ease on the comms programming.

Thanks

User avatar
tanlipseong
Posts: 31
Joined: Thu Aug 27, 2009 3:11 pm
Location: Malaysia
Contact:

Re: RS232 out and bit bang

Postby tanlipseong » Wed Sep 09, 2009 1:15 pm

My copy of Flowcode 3 (purchase from Farnell) came in yesterday.
Now i can send string to PC without Bit Banging.

Thanks a lot.

User avatar
Benj
Matrix Staff
Posts: 14075
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4297 times
Been thanked: 4051 times
Contact:

Re: RS232 out and bit bang

Postby Benj » Wed Sep 09, 2009 2:35 pm

Fantastic, glad your all up and running with the pro version now. Thanks for letting us know.

User avatar
tanlipseong
Posts: 31
Joined: Thu Aug 27, 2009 3:11 pm
Location: Malaysia
Contact:

Re: RS232 out and bit bang

Postby tanlipseong » Thu Sep 10, 2009 9:08 am

Benj,

i got a problem that need help, i am using 16F887 to read ADC and send the data through RS232 to a PC, (PC running Excel VBA).

My question is how do i convert the value read by ADC and send to PC as Voltage? (i am measuring 0.76V at the ADC input and how do i convert the ADC Byte value to 0.76V).

Is there some kind of Macro to do the conversion easily?

Please help.

User avatar
tanlipseong
Posts: 31
Joined: Thu Aug 27, 2009 3:11 pm
Location: Malaysia
Contact:

Re: RS232 out and bit bang

Postby tanlipseong » Fri Sep 11, 2009 7:37 am

Benj,

I use Lookup table to do the conversion job, the problem is solve but please let me know if there are better way to do it.

Thanks in advance.

User avatar
Benj
Matrix Staff
Posts: 14075
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4297 times
Been thanked: 4051 times
Contact:

Re: RS232 out and bit bang

Postby Benj » Fri Sep 11, 2009 8:41 am

Hello

Flowcode V4 comes with a ReadAsVoltage and a ReadAsString macro built into the ADC component which will return the value as a voltage as well as a function to send string data over the RS232. This makes the process a lot easier. In V3 a lookup table is probably the best method.

User avatar
tanlipseong
Posts: 31
Joined: Thu Aug 27, 2009 3:11 pm
Location: Malaysia
Contact:

Re: RS232 out and bit bang

Postby tanlipseong » Sat Sep 12, 2009 11:20 am

OK, i will stict to Flowcode V3 for now.

thanks alot.