PIC16F887 and RS232 problem
Posted: Tue Dec 18, 2007 7:40 pm
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!
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!