RS232 out and bit bang
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
RS232 out and bit bang
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?
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?
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: RS232 out and bit bang
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.
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.
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: RS232 out and bit bang
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 out and bit bang
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: RS232 out and bit bang
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
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
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: RS232 out and bit bang
My copy of Flowcode 3 (purchase from Farnell) came in yesterday.
Now i can send string to PC without Bit Banging.
Thanks a lot.
Now i can send string to PC without Bit Banging.
Thanks a lot.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 out and bit bang
Fantastic, glad your all up and running with the pro version now. Thanks for letting us know.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: RS232 out and bit bang
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.
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.
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: RS232 out and bit bang
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.
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.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 out and bit bang
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact: