Page 1 of 1

RS232 out and bit bang

Posted: Fri Aug 28, 2009 9:21 am
by tanlipseong
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?

Re: RS232 out and bit bang

Posted: Sat Aug 29, 2009 4:20 pm
by tanlipseong
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.

Re: RS232 out and bit bang

Posted: Tue Sep 01, 2009 1:48 am
by tanlipseong
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

Re: RS232 out and bit bang

Posted: Thu Sep 03, 2009 8:42 am
by Benj
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.

Re: RS232 out and bit bang

Posted: Thu Sep 03, 2009 12:13 pm
by tanlipseong
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

Re: RS232 out and bit bang

Posted: Wed Sep 09, 2009 1:15 pm
by tanlipseong
My copy of Flowcode 3 (purchase from Farnell) came in yesterday.
Now i can send string to PC without Bit Banging.

Thanks a lot.

Re: RS232 out and bit bang

Posted: Wed Sep 09, 2009 2:35 pm
by Benj
Fantastic, glad your all up and running with the pro version now. Thanks for letting us know.

Re: RS232 out and bit bang

Posted: Thu Sep 10, 2009 9:08 am
by tanlipseong
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.

Re: RS232 out and bit bang

Posted: Fri Sep 11, 2009 7:37 am
by tanlipseong
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.

Re: RS232 out and bit bang

Posted: Fri Sep 11, 2009 8:41 am
by Benj
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.

Re: RS232 out and bit bang

Posted: Sat Sep 12, 2009 11:20 am
by tanlipseong
OK, i will stict to Flowcode V3 for now.

thanks alot.