PIC18F26K22 EUSART 2 not working

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
leoo
Flowcode V4 User
Posts: 53
Joined: Mon Jan 19, 2009 11:43 am
Contact:

PIC18F26K22 EUSART 2 not working

Post by leoo »

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

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PIC18F26K22 EUSART 2 not working

Post by Benj »

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.

leoo
Flowcode V4 User
Posts: 53
Joined: Mon Jan 19, 2009 11:43 am
Contact:

Re: PIC18F26K22 EUSART 2 not working

Post by leoo »

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
18F26K22 2xEUSART and Int.c
(36.77 KiB) Downloaded 204 times
18F26K22 2xEUSART and Int.fcf
(7.5 KiB) Downloaded 181 times

leoo
Flowcode V4 User
Posts: 53
Joined: Mon Jan 19, 2009 11:43 am
Contact:

Re: PIC18F26K22 EUSART 2 not working

Post by leoo »

Hi Ben, Have you had a chance to look at the attached files?

Kind regards.
Leo

Sefi
Posts: 56
Joined: Mon Sep 29, 2008 10:26 am
Contact:

Re: PIC18F26K22 EUSART 2 not working

Post by Sefi »

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

leoo
Flowcode V4 User
Posts: 53
Joined: Mon Jan 19, 2009 11:43 am
Contact:

Re: PIC18F26K22 EUSART 2 not working

Post by leoo »

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

Sefi
Posts: 56
Joined: Mon Sep 29, 2008 10:26 am
Contact:

Re: PIC18F26K22 EUSART 2 not working

Post by Sefi »

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

Post Reply