I would like to replace my chip from PIC18F47J13 to PIC18F47K40 as it has more program memory but the only problem i have is the this chip has only 1 RS343 port. If i create a RS232 port on say RD6 (TX) RD7 (RX) using the software option Is it possible to create a custom interrupt that is triggered when there is incoming data. If so how would i do this
Custom Interrupt
Moderator: Benj
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Custom Interrupt
Hi Guys
I would like to replace my chip from PIC18F47J13 to PIC18F47K40 as it has more program memory but the only problem i have is the this chip has only 1 RS343 port. If i create a RS232 port on say RD6 (TX) RD7 (RX) using the software option Is it possible to create a custom interrupt that is triggered when there is incoming data. If so how would i do this
I would like to replace my chip from PIC18F47J13 to PIC18F47K40 as it has more program memory but the only problem i have is the this chip has only 1 RS343 port. If i create a RS232 port on say RD6 (TX) RD7 (RX) using the software option Is it possible to create a custom interrupt that is triggered when there is incoming data. If so how would i do this
- 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: Custom Interrupt
Hello,
I would recommend finding a different chip with more memory and the second UART peripheral. Hardware UARTs are much better.
Software UARTs are ok for transmitting data as long as you don't have any interrupts enabled in your program. For receiving data they can be used but only reliably with an interrupt (INT/IOC) to monitor for the start bit falling edge and again this has to be the only interrupt enabled in the program. The reason for no (other) interrupts is that if you interrupt while actively receiving or transmitting a byte then the byte will become corrupted.
Here are all the current PIC8 devices that have 2 or more UARTs.
16F1946:2, 16F1947:2, 16LF1946:2, 16LF1947:2, 18F23K22:2, 18F24J11:2, 18F24J50:2, 18F24K22:2, 18F24K42:2, 18F25J11:2, 18F25J50:2, 18F25K22:2, 18F25K42:2, 18F25K80:2, 18F26J11:2, 18F26J13:2, 18F26J50:2, 18F26J53:2, 18F26K22:2, 18F26K40:2, 18F26K42:2, 18F26K80:2, 18F27J13:2, 18F27J53:2, 18F27K40:2, 18F27K42:2, 18F43K22:2, 18F44J11:2, 18F44J50:2, 18F44K22:2, 18F45J11:2, 18F45J50:2, 18F45K22:2, 18F45K40:2, 18F45K42:2, 18F45K80:2, 18F46J11:2, 18F46J13:2, 18F46J50:2, 18F46J53:2, 18F46K22:2, 18F46K40:2, 18F46K42:2, 18F46K80:2, 18F47J13:2, 18F47J53:2, 18F47K40:2, 18F47K42:2, 18F6310:2, 18F6390:2, 18F6410:2, 18F6490:2, 18F6520:2, 18F6527:2, 18F65J10:2, 18F65J15:2, 18F65J50:2, 18F65K22:2, 18F65K80:2, 18F6620:2, 18F6622:2, 18F6627:2, 18F66J10:2, 18F66J11:2, 18F66J15:2, 18F66J16:2, 18F66J50:2, 18F66J55:2, 18F66J90:2, 18F66J93:2, 18F66K22:2, 18F66K80:2, 18F6720:2, 18F6722:2, 18F67J10:2, 18F67J11:2, 18F67J50:2, 18F67J90:2, 18F67J93:2, 18F67K22:2, 18F8310:2, 18F8390:2, 18F8410:2, 18F8490:2, 18F8520:2, 18F8527:2, 18F85J10:2, 18F85J15:2, 18F85J50:2, 18F85K22:2, 18F8620:2, 18F8622:2, 18F8627:2, 18F86J10:2, 18F86J11:2, 18F86J15:2, 18F86J16:2, 18F86J50:2, 18F86J55:2, 18F86J60:2, 18F86J65:2, 18F86J90:2, 18F86J93:2, 18F86K22:2, 18F8720:2, 18F8722:2, 18F87J10:2, 18F87J11:2, 18F87J50:2, 18F87J60:2, 18F87J90:2, 18F87J93:2, 18F87K22:2, 18F96J60:2, 18F96J65:2, 18F97J60:2, 18LF23K22:2, 18LF24J11:2, 18LF24J50:2, 18LF24K22:2, 18LF24K42:2, 18LF25J11:2, 18LF25J50:2, 18LF25K22:2, 18LF25K42:2, 18LF25K80:2, 18LF26J11:2, 18LF26J13:2, 18LF26J50:2, 18LF26J53:2, 18LF26K22:2, 18LF26K40:2, 18LF26K42:2, 18LF26K80:2, 18LF27J13:2, 18LF27J53:2, 18LF27K40:2, 18LF27K42:2, 18LF43K22:2, 18LF44J11:2, 18LF44J50:2, 18LF44K22:2, 18LF45J11:2, 18LF45J50:2, 18LF45K22:2, 18LF45K40:2, 18LF45K42:2, 18LF45K80:2, 18LF46J11:2, 18LF46J13:2, 18LF46J50:2, 18LF46J53:2, 18LF46K22:2, 18LF46K40:2, 18LF46K42:2, 18LF46K80:2, 18LF47J13:2, 18LF47J53:2, 18LF47K40:2, 18LF47K42:2, 18LF6310:2, 18LF6390:2, 18LF6410:2, 18LF6490:2, 18LF6520:2, 18LF6527:2, 18LF65K80:2, 18LF6620:2, 18LF6622:2, 18LF6627:2, 18LF66K80:2, 18LF6720:2, 18LF6722:2, 18LF8310:2, 18LF8390:2, 18LF8410:2, 18LF8490:2, 18LF8520:2, 18LF8527:2, 18LF8620:2, 18LF8622:2, 18LF8627:2, 18LF8720:2, 18LF8722:2
Hang on, the 47K40 is in this list as having 2 UARTs? And it has the exact same amount of ROM as the 47J13?
Just spotted that the 47K40 is missing the second RXINT interrupt. I'll get this fixed and post the updated file.
I would recommend finding a different chip with more memory and the second UART peripheral. Hardware UARTs are much better.
Software UARTs are ok for transmitting data as long as you don't have any interrupts enabled in your program. For receiving data they can be used but only reliably with an interrupt (INT/IOC) to monitor for the start bit falling edge and again this has to be the only interrupt enabled in the program. The reason for no (other) interrupts is that if you interrupt while actively receiving or transmitting a byte then the byte will become corrupted.
Here are all the current PIC8 devices that have 2 or more UARTs.
16F1946:2, 16F1947:2, 16LF1946:2, 16LF1947:2, 18F23K22:2, 18F24J11:2, 18F24J50:2, 18F24K22:2, 18F24K42:2, 18F25J11:2, 18F25J50:2, 18F25K22:2, 18F25K42:2, 18F25K80:2, 18F26J11:2, 18F26J13:2, 18F26J50:2, 18F26J53:2, 18F26K22:2, 18F26K40:2, 18F26K42:2, 18F26K80:2, 18F27J13:2, 18F27J53:2, 18F27K40:2, 18F27K42:2, 18F43K22:2, 18F44J11:2, 18F44J50:2, 18F44K22:2, 18F45J11:2, 18F45J50:2, 18F45K22:2, 18F45K40:2, 18F45K42:2, 18F45K80:2, 18F46J11:2, 18F46J13:2, 18F46J50:2, 18F46J53:2, 18F46K22:2, 18F46K40:2, 18F46K42:2, 18F46K80:2, 18F47J13:2, 18F47J53:2, 18F47K40:2, 18F47K42:2, 18F6310:2, 18F6390:2, 18F6410:2, 18F6490:2, 18F6520:2, 18F6527:2, 18F65J10:2, 18F65J15:2, 18F65J50:2, 18F65K22:2, 18F65K80:2, 18F6620:2, 18F6622:2, 18F6627:2, 18F66J10:2, 18F66J11:2, 18F66J15:2, 18F66J16:2, 18F66J50:2, 18F66J55:2, 18F66J90:2, 18F66J93:2, 18F66K22:2, 18F66K80:2, 18F6720:2, 18F6722:2, 18F67J10:2, 18F67J11:2, 18F67J50:2, 18F67J90:2, 18F67J93:2, 18F67K22:2, 18F8310:2, 18F8390:2, 18F8410:2, 18F8490:2, 18F8520:2, 18F8527:2, 18F85J10:2, 18F85J15:2, 18F85J50:2, 18F85K22:2, 18F8620:2, 18F8622:2, 18F8627:2, 18F86J10:2, 18F86J11:2, 18F86J15:2, 18F86J16:2, 18F86J50:2, 18F86J55:2, 18F86J60:2, 18F86J65:2, 18F86J90:2, 18F86J93:2, 18F86K22:2, 18F8720:2, 18F8722:2, 18F87J10:2, 18F87J11:2, 18F87J50:2, 18F87J60:2, 18F87J90:2, 18F87J93:2, 18F87K22:2, 18F96J60:2, 18F96J65:2, 18F97J60:2, 18LF23K22:2, 18LF24J11:2, 18LF24J50:2, 18LF24K22:2, 18LF24K42:2, 18LF25J11:2, 18LF25J50:2, 18LF25K22:2, 18LF25K42:2, 18LF25K80:2, 18LF26J11:2, 18LF26J13:2, 18LF26J50:2, 18LF26J53:2, 18LF26K22:2, 18LF26K40:2, 18LF26K42:2, 18LF26K80:2, 18LF27J13:2, 18LF27J53:2, 18LF27K40:2, 18LF27K42:2, 18LF43K22:2, 18LF44J11:2, 18LF44J50:2, 18LF44K22:2, 18LF45J11:2, 18LF45J50:2, 18LF45K22:2, 18LF45K40:2, 18LF45K42:2, 18LF45K80:2, 18LF46J11:2, 18LF46J13:2, 18LF46J50:2, 18LF46J53:2, 18LF46K22:2, 18LF46K40:2, 18LF46K42:2, 18LF46K80:2, 18LF47J13:2, 18LF47J53:2, 18LF47K40:2, 18LF47K42:2, 18LF6310:2, 18LF6390:2, 18LF6410:2, 18LF6490:2, 18LF6520:2, 18LF6527:2, 18LF65K80:2, 18LF6620:2, 18LF6622:2, 18LF6627:2, 18LF66K80:2, 18LF6720:2, 18LF6722:2, 18LF8310:2, 18LF8390:2, 18LF8410:2, 18LF8490:2, 18LF8520:2, 18LF8527:2, 18LF8620:2, 18LF8622:2, 18LF8627:2, 18LF8720:2, 18LF8722:2
Hang on, the 47K40 is in this list as having 2 UARTs? And it has the exact same amount of ROM as the 47J13?
Just spotted that the 47K40 is missing the second RXINT interrupt. I'll get this fixed and post the updated file.
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
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: Custom Interrupt
Hi Ben
Thanks that will be much appreciated as the 47K40 is the same program memory but it also has some eeprom and is much more affordable. I was also looking at the 27K40 and not sure but that also seems to not have the second Interrupt, Oops this one wont work i need 44 pin I-PT
Thanks that will be much appreciated as the 47K40 is the same program memory but it also has some eeprom and is much more affordable. I was also looking at the 27K40 and not sure but that also seems to not have the second Interrupt, Oops this one wont work i need 44 pin I-PT
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: Custom Interrupt
Hi Ben
Thanks for the updated files not sure what the problem is but i changed the chip in my program from 18F46K80 to 18f47K40 and when i compile i get these errors is it something I'm doing wrong or something with the chip as it works fine with the 18F46K80
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_EEPROM.c: FC_CAL_EE_Read()
44: EEADR = Address & 0xff;
^ (192) undefined identifier "EEADR"
46: EEADRH = (Address & 0xff00) >> 8;
^ (192) undefined identifier "EEADRH"
52: EECON1bits.EEPGD = 0;
^ (192) undefined identifier "EECON1bits"
^ (196) struct/union required
53: EECON1bits.CFGS = 0;
^ (196) struct/union required
55: EECON1bits.RD = 1;
^ (196) struct/union required
56: data = EEDATA;
^ (192) undefined identifier "EEDATA"
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_EEPROM.c: FC_CAL_EE_Write()
70: while ((EECON1bits.WR));
^ (192) undefined identifier "EECON1bits"
^ (196) struct/union required
71: EEADR = Address & 0xff;
^ (192) undefined identifier "EEADR"
73: EEADRH = (Address & 0xff00) >> 8;
^ (192) undefined identifier "EEADRH"
75: EEDATA = Data;
^ (192) undefined identifier "EEDATA"
80: EECON1bits.EEPGD = 0;
^ (196) struct/union required
81: EECON1bits.CFGS = 0;
^ (196) struct/union required
83: EECON1bits.WREN = 1;
^ (196) struct/union required
86: EECON2 = 0x55;
^ (192) undefined identifier "EECON2"
88: EECON1bits.WR = 1;
^ (196) struct/union required
89: while ((EECON1bits.WR));
^ (196) struct/union required
92: EECON1bits.WREN = 0;
^ (196) struct/union required
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Init_1()
306: TXSTAbits.BRGH = 1;
^ (192) undefined identifier "TXSTAbits"
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 306: too many errors (21)
(908) exit status = 1
(908) exit status = 1
C:\Program Files\Flowcode 7\compilers\pic\bin\xc8.exe reported error code 1
Thanks for the updated files not sure what the problem is but i changed the chip in my program from 18F46K80 to 18f47K40 and when i compile i get these errors is it something I'm doing wrong or something with the chip as it works fine with the 18F46K80
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_EEPROM.c: FC_CAL_EE_Read()
44: EEADR = Address & 0xff;
^ (192) undefined identifier "EEADR"
46: EEADRH = (Address & 0xff00) >> 8;
^ (192) undefined identifier "EEADRH"
52: EECON1bits.EEPGD = 0;
^ (192) undefined identifier "EECON1bits"
^ (196) struct/union required
53: EECON1bits.CFGS = 0;
^ (196) struct/union required
55: EECON1bits.RD = 1;
^ (196) struct/union required
56: data = EEDATA;
^ (192) undefined identifier "EEDATA"
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_EEPROM.c: FC_CAL_EE_Write()
70: while ((EECON1bits.WR));
^ (192) undefined identifier "EECON1bits"
^ (196) struct/union required
71: EEADR = Address & 0xff;
^ (192) undefined identifier "EEADR"
73: EEADRH = (Address & 0xff00) >> 8;
^ (192) undefined identifier "EEADRH"
75: EEDATA = Data;
^ (192) undefined identifier "EEDATA"
80: EECON1bits.EEPGD = 0;
^ (196) struct/union required
81: EECON1bits.CFGS = 0;
^ (196) struct/union required
83: EECON1bits.WREN = 1;
^ (196) struct/union required
86: EECON2 = 0x55;
^ (192) undefined identifier "EECON2"
88: EECON1bits.WR = 1;
^ (196) struct/union required
89: while ((EECON1bits.WR));
^ (196) struct/union required
92: EECON1bits.WREN = 0;
^ (196) struct/union required
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Init_1()
306: TXSTAbits.BRGH = 1;
^ (192) undefined identifier "TXSTAbits"
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 306: too many errors (21)
(908) exit status = 1
(908) exit status = 1
C:\Program Files\Flowcode 7\compilers\pic\bin\xc8.exe reported error code 1
- 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: Custom Interrupt
Thanks for letting us know. It appears the EEPROM is controlled via the flash NVMCON registers on this device.
Here is an updated CAL C file that should hopefully solve the problem for you.
Simply copy the attached file into your "Flowcode 7\CAL\PIC" folder and then hopefully the program will compile correctly.
Let me know how you get on.
Here is an updated CAL C file that should hopefully solve the problem for you.
Simply copy the attached file into your "Flowcode 7\CAL\PIC" folder and then hopefully the program will compile correctly.
Let me know how you get on.
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
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: Custom Interrupt
Hi Ben
Thanks again that seems to have sorted the EEPROM error out now there's another error with the UART. If i check in the properties the and i try select channel 1 or 2 there is no connections. I'm also getting the following compiling error
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Init_1()
306: TXSTAbits.BRGH = 1;
^ (192) undefined identifier "TXSTAbits"
^ (196) struct/union required
308: SPBRG = (((48000000 / (115200)) -
/ 16);
^ (192) undefined identifier "SPBRG"
309: RCSTA = 0;
^ (192) undefined identifier "RCSTA"
316: RCSTAbits.SPEN = 1;
^ (192) undefined identifier "RCSTAbits"
^ (196) struct/union required
317: TXSTAbits.TXEN = 1;
^ (196) struct/union required
318: RCSTAbits.CREN = 1;
^ (196) struct/union required
325: PIE1bits.RCIE = 0;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S225
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Uninit_1()
384: RCSTA = 0;
^ (192) undefined identifier "RCSTA"
385: TXSTA = 0;
^ (192) undefined identifier "TXSTA"
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Send_1()
431: while ((PIR1bits.TXIF) == 0);
^ (255) not a member of the struct/union ""
^ (207) simple type required for "=="
439: TXREG = nChar;
^ (192) undefined identifier "TXREG"
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Receive_1()
511: regcheck = (PIR1bits.RCIF);
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
volatile union S246 -> unsigned char
^ (181) non-scalar types can't be converted to other types
541: regcheck = (RCSTAbits.FERR);
^ (192) undefined identifier "RCSTAbits"
^ (196) struct/union required
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 544: too many errors (21)
(908) exit status = 1
(908) exit status = 1
Another thing this has an internal clock speed of 64Mhz and in the general options you can only choose up to 48Mhz. Please could you check if i have set the clock speed right in the small test program.
Also am i right in saying if i want to use the HFINTOC with HFFRQ = 64Mhz i do not need to put a crystal on board and will have an extra 2 IO pins
Thanks again that seems to have sorted the EEPROM error out now there's another error with the UART. If i check in the properties the and i try select channel 1 or 2 there is no connections. I'm also getting the following compiling error
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Init_1()
306: TXSTAbits.BRGH = 1;
^ (192) undefined identifier "TXSTAbits"
^ (196) struct/union required
308: SPBRG = (((48000000 / (115200)) -
^ (192) undefined identifier "SPBRG"
309: RCSTA = 0;
^ (192) undefined identifier "RCSTA"
316: RCSTAbits.SPEN = 1;
^ (192) undefined identifier "RCSTAbits"
^ (196) struct/union required
317: TXSTAbits.TXEN = 1;
^ (196) struct/union required
318: RCSTAbits.CREN = 1;
^ (196) struct/union required
325: PIE1bits.RCIE = 0;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S225
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Uninit_1()
384: RCSTA = 0;
^ (192) undefined identifier "RCSTA"
385: TXSTA = 0;
^ (192) undefined identifier "TXSTA"
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Send_1()
431: while ((PIR1bits.TXIF) == 0);
^ (255) not a member of the struct/union ""
^ (207) simple type required for "=="
439: TXREG = nChar;
^ (192) undefined identifier "TXREG"
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Receive_1()
511: regcheck = (PIR1bits.RCIF);
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
volatile union S246 -> unsigned char
^ (181) non-scalar types can't be converted to other types
541: regcheck = (RCSTAbits.FERR);
^ (192) undefined identifier "RCSTAbits"
^ (196) struct/union required
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 544: too many errors (21)
(908) exit status = 1
(908) exit status = 1
Another thing this has an internal clock speed of 64Mhz and in the general options you can only choose up to 48Mhz. Please could you check if i have set the clock speed right in the small test program.
Also am i right in saying if i want to use the HFINTOC with HFFRQ = 64Mhz i do not need to put a crystal on board and will have an extra 2 IO pins
- Attachments
-
- Flash_Test_PIC18F47K40.fcfx
- (12.78 KiB) Downloaded 387 times
- 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: Custom Interrupt
Hello,
Again thanks for letting us know.
For the missing pins, it looks like this chip has the remappable IO functionality so you assign the hardware pins using the TX Remap and RX Remap properties.
However this on it's own did not solve the compilation errors, though I only get errors on channel 1.
Anyway this should solve the problem for you, lives in the same folder as the last posted file.
Just investigating the clock speed issue for you now, the intosc helper in the definition file seems to correctly list the 64MHz option. The project options may not have 64000000 in the drop down list but you should be able to type this value in directly.
Again thanks for letting us know.
For the missing pins, it looks like this chip has the remappable IO functionality so you assign the hardware pins using the TX Remap and RX Remap properties.
However this on it's own did not solve the compilation errors, though I only get errors on channel 1.
Anyway this should solve the problem for you, lives in the same folder as the last posted file.
Just investigating the clock speed issue for you now, the intosc helper in the definition file seems to correctly list the 64MHz option. The project options may not have 64000000 in the drop down list but you should be able to type this value in directly.
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
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: Custom Interrupt
Hi Ben
Still seem to be having problems with the UART cannot select the pins. I have have downloaded the PIC_CAL_UART and pasted in the Program Files / Flowcode7 / CAL / PIC folder but still cannot select pins not sure what I'm doing wrong
Still seem to be having problems with the UART cannot select the pins. I have have downloaded the PIC_CAL_UART and pasted in the Program Files / Flowcode7 / CAL / PIC folder but still cannot select pins not sure what I'm doing wrong
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: Custom Interrupt
Hi Leigh
Any news on sorting the FCD issue out yet? why I'm asking is I have a few orders pending have populated boards now need to get the software tested with the new chip.
Any news on sorting the FCD issue out yet? why I'm asking is I have a few orders pending have populated boards now need to get the software tested with the new chip.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: Custom Interrupt
Hi
I did have a look, but found that there are also some issues with the way that the component works out and displays the re-mapping of the pins (for this family of devices).
It looks like this could be some work in progress of Ben's, so I think it is going to be most productive if I leave this to Ben on his return next Monday.
Hope that's OK for you?
I did have a look, but found that there are also some issues with the way that the component works out and displays the re-mapping of the pins (for this family of devices).
It looks like this could be some work in progress of Ben's, so I think it is going to be most productive if I leave this to Ben on his return next Monday.
Hope that's OK for you?
- 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: Custom Interrupt
Hello,
Thanks I've seen it now. This updated UART component should solve the problem.
Just drop the file into your "Flowcode 7/components" folder, restart Flowcode and all the port pins should now be available.
Thanks I've seen it now. This updated UART component should solve the problem.
Just drop the file into your "Flowcode 7/components" folder, restart Flowcode and all the port pins should now be available.
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
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: Custom Interrupt
Hi Ben
We seem to have a problem with this chip i now can set the UART pins but it does not send anything out on the TX pins of both UART'S and when i try to run my test program in flwcode it stops working. Also if i try to compile when i set it to 9600 board rate i get a compilation error
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c:
211: #define MX_HARD_BAUD_X (((MX_CLK_SPEED / MX_UART_BAUD_X) -
/ 16) //Was - 16 but had issues with rounding down
(111) redefining preprocessor macro "MX_HARD_BAUD_X" (C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 217) ^ (warning)
212: #define MX_HARD_SLOW_X 0
^ (111) redefining preprocessor macro "MX_HARD_SLOW_X" (C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 218) (warning)
but this dose not bother me as I'm using 115200 board rate and that compiles just fine.
I think i have the correct clock setting as i have tested it on a board with a flashing LED and set to approximately 1Hz and it looks
right
We seem to have a problem with this chip i now can set the UART pins but it does not send anything out on the TX pins of both UART'S and when i try to run my test program in flwcode it stops working. Also if i try to compile when i set it to 9600 board rate i get a compilation error
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c:
211: #define MX_HARD_BAUD_X (((MX_CLK_SPEED / MX_UART_BAUD_X) -
(111) redefining preprocessor macro "MX_HARD_BAUD_X" (C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 217) ^ (warning)
212: #define MX_HARD_SLOW_X 0
^ (111) redefining preprocessor macro "MX_HARD_SLOW_X" (C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 218) (warning)
but this dose not bother me as I'm using 115200 board rate and that compiles just fine.
I think i have the correct clock setting as i have tested it on a board with a flashing LED and set to approximately 1Hz and it looks
right
- 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: Custom Interrupt
Hello,
Looks like the chip at your chosen clock speed and 9600 baud is overflowing the baud rate register and so is automatically switching to the slow baud rate mode.
This slow baud rate mode is redefining the baud rate using the slower calculation.
I do use the #undef command to undefine the initial out of range baud but this doesn't seem to be bypassing the warning as expected.
I've checked the XC8 compiler manual and #undef is definitely in there as valid code.
Hmmm...
Anyway this doesn't explain the problem that the TX pins are not generating the correct output. Do the TX pins go to a logic 1 or do they sit in the default high impedance state?
I'll go through the datasheet for the device tomorrow and make sure there's nothing special case about the UART registers.
Looks like the chip at your chosen clock speed and 9600 baud is overflowing the baud rate register and so is automatically switching to the slow baud rate mode.
This slow baud rate mode is redefining the baud rate using the slower calculation.
I do use the #undef command to undefine the initial out of range baud but this doesn't seem to be bypassing the warning as expected.
I've checked the XC8 compiler manual and #undef is definitely in there as valid code.
Hmmm...
Anyway this doesn't explain the problem that the TX pins are not generating the correct output. Do the TX pins go to a logic 1 or do they sit in the default high impedance state?
I'll go through the datasheet for the device tomorrow and make sure there's nothing special case about the UART registers.
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
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: Custom Interrupt
Hi Ben
Everything seems to be working now and i can read the UART on my PC using USB to RS232 adapter so not sure what was wrong yesterday. One question how dose the auto-band detect work on this chip?
Everything seems to be working now and i can read the UART on my PC using USB to RS232 adapter so not sure what was wrong yesterday. One question how dose the auto-band detect work on this chip?
- 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: Custom Interrupt
Hmm, Glad it's working correctly for you now.
I've now fixed the redefinition warning from being generated but it is safe to ignore the warning.
We don't currently support the auto baud functionality in the UART code abstraction layer (CAL) but you should be able to enable it in your Flowchart using a line or two of C code.
I'll add it to the list to see how difficult it would be to add this.
Looks like you would initialise the UART and then use the following line of C to enable the auto baud.
For UART 1
For UART 2
Once Auto baud is enabled I think you have to send the value 0x55 or ASCII 'U' to the micro to setup the baud register.
I've now fixed the redefinition warning from being generated but it is safe to ignore the warning.
We don't currently support the auto baud functionality in the UART code abstraction layer (CAL) but you should be able to enable it in your Flowchart using a line or two of C code.
I'll add it to the list to see how difficult it would be to add this.
Looks like you would initialise the UART and then use the following line of C to enable the auto baud.
For UART 1
Code: Select all
BAUD1CONbits.ABDEN = 1;Code: Select all
BAUD2CONbits.ABDEN = 1;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
- jollybv
- Flowcode v5 User
- Posts: 376
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
Re: Custom Interrupt
Hi Ben
Just got my new chips the PIC18F47K40 and it dose not seem to work for some reason in my test program the 1Hz timer interrup works but in the loop it sends the UART TX every +- 10 seconds witch is very slow as i have no delays. Also if i set the FAT1 to channel 1 i get the flowing compilation error.
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_SPI.c: FC_CAL_SPI_Master_Init_1()
190: SSPSTATbits.CKE = (((2) & 0x02))?1:0;
^ (192) undefined identifier "SSPSTATbits"
^ (196) struct/union required
191: SSPSTATbits.SMP = (((2) & 0x04))?1:0;
^ (196) struct/union required
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_SPI.c: FC_CAL_SPI_Master_Byte_1()
301: SSPBUF = DataOut;
^ (192) undefined identifier "SSPBUF"
302: while ((SSPSTAT & 0x01) == 0);
^ (192) undefined identifier "SSPSTAT"
(908) exit status = 1
(908) exit status = 1
If i use the LF version i was testing with previously everything seems to work just not the FAT1 Channel 1 settings so very confused
Just got my new chips the PIC18F47K40 and it dose not seem to work for some reason in my test program the 1Hz timer interrup works but in the loop it sends the UART TX every +- 10 seconds witch is very slow as i have no delays. Also if i set the FAT1 to channel 1 i get the flowing compilation error.
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_SPI.c: FC_CAL_SPI_Master_Init_1()
190: SSPSTATbits.CKE = (((2) & 0x02))?1:0;
^ (192) undefined identifier "SSPSTATbits"
^ (196) struct/union required
191: SSPSTATbits.SMP = (((2) & 0x04))?1:0;
^ (196) struct/union required
C:\Program Files\Flowcode 7\CAL\PIC\PIC_CAL_SPI.c: FC_CAL_SPI_Master_Byte_1()
301: SSPBUF = DataOut;
^ (192) undefined identifier "SSPBUF"
302: while ((SSPSTAT & 0x01) == 0);
^ (192) undefined identifier "SSPSTAT"
(908) exit status = 1
(908) exit status = 1
If i use the LF version i was testing with previously everything seems to work just not the FAT1 Channel 1 settings so very confused
- Attachments
-
- Flash_Test_PIC18F47K40.fcfx
- (18.29 KiB) Downloaded 256 times