Hello!
I have a problem when I'm trying to send bytes using RS232. My intention is to implement a program, which monitors 32 switches and reports that information in several bytes to RS232 port.
Here is fcf file supporting my idea:
http://tux.oliotalo.fi/pic-test/menumat.fcf
This is a simpler RS232 test, which sends "hello" in one second intervals:
http://tux.oliotalo.fi/pic-test/testi.fcf
Even this simple test doesn't send anything proper.
I'm using Flowcode v3.2.2.40, Microchip's MPLAB v8.00 and PIC-MCP programmer. I took .asm file produced by Flowcode and compiled it with MPLAB and it compiled succesfully, except some nagging about operand not in bank 0, but this shouldn't be a problem.
http://tux.oliotalo.fi/pic-test/mplab_build.png
Here is configuration bits I have used:
http://tux.oliotalo.fi/pic-test/mplab_c ... e_bits.png
It programmed also fine:
http://tux.oliotalo.fi/pic-test/mplab_program.png
I'm using MAX232 between PIC and PC. I'm receiving only something like "00 f0 f0 00 00" from PIC in hex format. I checked with oscilloscope, that voltage in TX pin is almost all the time 5V and after MAX232 about -10V. TX pin voltage level drops quickly in few seconds intervals, but I can't see any proper activity.
Am I doing something wrong? Is this some kind of timing issue? Are the configuration bits set correctly? Should I use external oscillator instead of internal? Does Flowcode or compiler something wrong?
Another strange thing with this PIC is that when I'm giving 5V to RB3 pin (which should be normal input pin), TX pin level drops near 0. Is it even possible to use all available pins, which are not RX or TX (PortA, PortB, PortC (excluding TX and RX), PortD and PortE)?
I can provide more information if you need.
I would be very pleased if you can help me!
PIC16F887 and RS232 problem
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Hello,
I think it's likely to be a timing issue. You need to set the appropriate clock speed within Flowcode. To make sure your clock settings are correct, create a simple program that flashes an LED on and off every second.
Also, your configuration data is enabling the Low Voltage Programming bit (which is RB3). Applying 5V to RB3 with LVP enabled will stop the program running and put the chip into programming mode.
I hope this helps.
I think it's likely to be a timing issue. You need to set the appropriate clock speed within Flowcode. To make sure your clock settings are correct, create a simple program that flashes an LED on and off every second.
Also, your configuration data is enabling the Low Voltage Programming bit (which is RB3). Applying 5V to RB3 with LVP enabled will stop the program running and put the chip into programming mode.
I hope this helps.
Okay, it was a timing issue. 4 MHz was the correct clock speed. Thank you!steve wrote: Hello,
I think it's likely to be a timing issue. You need to set the appropriate clock speed within Flowcode. To make sure your clock settings are correct, create a simple program that flashes an LED on and off every second.
This is working now also. Thanks!steve wrote: Also, your configuration data is enabling the Low Voltage Programming bit (which is RB3). Applying 5V to RB3 with LVP enabled will stop the program running and put the chip into programming mode.
It helpedsteve wrote: I hope this helps.
![Smile :)](./images/smilies/icon_smile.gif)