Hello,
I have currently tried switching to the 18F26K22 chip because I need to talk to 2 RS232 peripherals and with this chip all the peripheral comms (USART 1 and 2 and SPI, etc) are on dedicated pins.The EUSART 1 works with no problems, but I cannot get the second EUSART to work. (I have also seen that the IOC (RB7:RB4) does not work).
The original project using 2 x RS232 (using a tri-state buffer to select between 2 RS232 devices), SPI, IOC, RXINT and INT0) worked OK on the 16F877A, but it only has 1 USART and no interrupt priority, etc, so I need to change chips.
Can you please offer some assistance on getting the (seems like port B) comms and interrupts sorted?
Kind regards.
Leo
PIC18F26K22 EUSART 2 not working
Moderator: Benj
- 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: PIC18F26K22 EUSART 2 not working
Hello Leo,
I have had a look at the code and it seems to be ok. I'm guessing it is compiling correctly for you.
Please could you post up a very simple program using UART2 and also include the generated C file and I will check this for you.
I have had a look at the code and it seems to be ok. I'm guessing it is compiling correctly for you.
Please could you post up a very simple program using UART2 and also include the generated C file and I will check this for you.
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
-
- Flowcode V4 User
- Posts: 55
- Joined: Mon Jan 19, 2009 11:43 am
- Has thanked: 41 times
- Been thanked: 9 times
Re: PIC18F26K22 EUSART 2 not working
Hi Ben,
Thanks for the response. Attached is the Flowcode and generated C files. I haven't included code for the IOC for the second EUSART.
Kind regards.
Leo
Thanks for the response. Attached is the Flowcode and generated C files. I haven't included code for the IOC for the second EUSART.
Kind regards.
Leo
Re: PIC18F26K22 EUSART 2 not working
Hi Leo,
Are you using the EB006 development board and the ICSP programming pins to program the chip?
If that is the case then you will need to move the ICSP jumper to the USB side after programming the chip to make pins 6 & 7 of port B reconnect with the output. I suspect this is what your problem is. The way the EB006 is designed is that when using the ICSP pins to program the chip the jumper disconnects pins 6 & 7 of port B.
Give this a go.
cheers
Sei
Are you using the EB006 development board and the ICSP programming pins to program the chip?
If that is the case then you will need to move the ICSP jumper to the USB side after programming the chip to make pins 6 & 7 of port B reconnect with the output. I suspect this is what your problem is. The way the EB006 is designed is that when using the ICSP pins to program the chip the jumper disconnects pins 6 & 7 of port B.
Give this a go.
cheers
Sei
-
- Flowcode V4 User
- Posts: 55
- Joined: Mon Jan 19, 2009 11:43 am
- Has thanked: 41 times
- Been thanked: 9 times
Re: PIC18F26K22 EUSART 2 not working
Hi Sei,
Thanks for responding. I have already done as you suggested, but this makes no difference.
I have checked and rechecked everything I know to check on the hardware side. Unfortunately my knowledge of C is extremely limited, but I've even tried to check whether there is an obvious error in the FCD file.
Ben has said that he would have a look at the code I posted to see if he can pick up anything untowards.
Kind regrads.
Leo
Thanks for responding. I have already done as you suggested, but this makes no difference.
I have checked and rechecked everything I know to check on the hardware side. Unfortunately my knowledge of C is extremely limited, but I've even tried to check whether there is an obvious error in the FCD file.
Ben has said that he would have a look at the code I posted to see if he can pick up anything untowards.
Kind regrads.
Leo
Re: PIC18F26K22 EUSART 2 not working
Hi Leo,
I have looked at the generated code and it seems that the UART port definitions are correct being ports C & B with pins 6 and 7 for transmit and receive. However, the RS232 port definitions show PortA pin 0 as TX and RX which is very odd. The RS232 is actually in the CAL layer and its port addresses are passed in so there must be some issue there. Both instances of the RS232 component are showing the TX_PORT as Porta and the TX and RX pins as pin 0 with CTS and RTS showing on PortC which is very odd as these settings are passed into this component. However, what I have just said is the way things work in FC5 and I just noticed you are using FC4 in which the CAL layer did not exist (if I remember correctly).
I will see if I have FC4 loaded on a machine and will have a quick look later, unless Ben comes back in the meantime.
regards
Sefi
I have looked at the generated code and it seems that the UART port definitions are correct being ports C & B with pins 6 and 7 for transmit and receive. However, the RS232 port definitions show PortA pin 0 as TX and RX which is very odd. The RS232 is actually in the CAL layer and its port addresses are passed in so there must be some issue there. Both instances of the RS232 component are showing the TX_PORT as Porta and the TX and RX pins as pin 0 with CTS and RTS showing on PortC which is very odd as these settings are passed into this component. However, what I have just said is the way things work in FC5 and I just noticed you are using FC4 in which the CAL layer did not exist (if I remember correctly).
I will see if I have FC4 loaded on a machine and will have a quick look later, unless Ben comes back in the meantime.
regards
Sefi