Hi,
I am working with an existing hardware design, the original code was written using MPLAB but I am trying to replicate it with Flowcode as a learning exercise. This design uses dsPICEP32GP504 and 4x MCP23017, the problem is I am using RC6 and RC5 for the I2C. The MCP23017 does not use these pins, is it possible to modify a copy of this component?
Thanks.
MCP23017
-
- Posts: 13
- http://meble-kuchenne.info.pl
- Joined: Fri Dec 04, 2020 5:22 pm
- Has thanked: 1 time
- Been thanked: 3 times
-
- Valued Contributor
- Posts: 447
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 81 times
- Been thanked: 243 times
Re: MCP23017
Hi,
Please could you copy the attached file into your PC directory C:\ProgramData\MatrixTSL\FlowcodeV9\FCD\PIC16
Then restart Flowcode.
btw. The dsPIC33EP32GP504 datasheet indicates that SDA1 and SCL1 are on pins C4 and C5, so I have implemented that.
Let me know if that's wrong.
Thanks
Please could you copy the attached file into your PC directory C:\ProgramData\MatrixTSL\FlowcodeV9\FCD\PIC16
Then restart Flowcode.
btw. The dsPIC33EP32GP504 datasheet indicates that SDA1 and SCL1 are on pins C4 and C5, so I have implemented that.
Let me know if that's wrong.
Thanks
- Attachments
-
- 33EP32GP504.fcdx
- (34.29 KiB) Downloaded 299 times
-
- Posts: 13
- Joined: Fri Dec 04, 2020 5:22 pm
- Has thanked: 1 time
- Been thanked: 3 times
Re: MCP23017
Hi LeighM,
Yes it is on C4 and C5 - sorry.
My project has loaded up with the correct ports on the properties tab.
Thanks
Yes it is on C4 and C5 - sorry.
My project has loaded up with the correct ports on the properties tab.
Thanks
-
- Posts: 13
- Joined: Fri Dec 04, 2020 5:22 pm
- Has thanked: 1 time
- Been thanked: 3 times
Re: MCP23017
Hi,
The next snag I've encountered is hopefully obvious to someone more experienced than me. I am looking at a single port pin A:7 that has a switch on the outside, when this switch is on I want to switch a pin on the dsPIC high but I can't seem to make it work, not sure what I'm doing wrong but suspect it has something to do with variables and return values.
Thanks
The next snag I've encountered is hopefully obvious to someone more experienced than me. I am looking at a single port pin A:7 that has a switch on the outside, when this switch is on I want to switch a pin on the dsPIC high but I can't seem to make it work, not sure what I'm doing wrong but suspect it has something to do with variables and return values.
Thanks
- Attachments
-
- P130 V01.fcfx
- (11.99 KiB) Downloaded 342 times
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 686 times
Re: MCP23017
Hello,
Your project looks ok to me though you might need to look at your configuration settings, the watchdog timer is enabled which could be causing problems.
Do you have pull up resistors connected between the SDA/SCL pins and VCC? Say 4K7 or 10K should work fine.
You can also enable internal pull up's in software using the following C code inside a C icon if you don't want to fit external ones.
It may be worth checking if you can talk to the expander IO at all using an WritePortPin and a LED.
If the LED is working but the switch is not then it may be worth checking the wiring of the switch is similar to how it's shown here.
https://www.flowcode.co.uk/wiki/index.p ... )#Examples
Your project looks ok to me though you might need to look at your configuration settings, the watchdog timer is enabled which could be causing problems.
Do you have pull up resistors connected between the SDA/SCL pins and VCC? Say 4K7 or 10K should work fine.
You can also enable internal pull up's in software using the following C code inside a C icon if you don't want to fit external ones.
Code: Select all
//Enable pull up resistor on pins C4 and C5
CNPUC |= 0x0030;
If the LED is working but the switch is not then it may be worth checking the wiring of the switch is similar to how it's shown here.
https://www.flowcode.co.uk/wiki/index.p ... )#Examples
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 13
- Joined: Fri Dec 04, 2020 5:22 pm
- Has thanked: 1 time
- Been thanked: 3 times
Re: MCP23017
Hi Ben,
Thanks for the reply I will check the configuration settings. I know the hardware is fine as this is a product that has been in production for several years. I am trying to replicate the functions of this product using Flowcode as a learning exercise. The bus has 4k7 pull ups and the existing hand written code works fine. The product has many switch inputs which are all connected to the IO expanders, there are no outputs connected directly to IO expander pins. So I'm convinced it is an error in my flowcode model.
Thanks
Thanks for the reply I will check the configuration settings. I know the hardware is fine as this is a product that has been in production for several years. I am trying to replicate the functions of this product using Flowcode as a learning exercise. The bus has 4k7 pull ups and the existing hand written code works fine. The product has many switch inputs which are all connected to the IO expanders, there are no outputs connected directly to IO expander pins. So I'm convinced it is an error in my flowcode model.
Thanks
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 686 times
Re: MCP23017
I beleive it could be these configuration settings at fault, they probably should be set to disabled to match your I2C pin selection.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 13
- Joined: Fri Dec 04, 2020 5:22 pm
- Has thanked: 1 time
- Been thanked: 3 times
Re: MCP23017
Hi Ben,
Yes that was the issue, I am now reading port pins without issue.
However, WritePortPin just does not seem to work at all.
Yes that was the issue, I am now reading port pins without issue.
However, WritePortPin just does not seem to work at all.
-
- Posts: 13
- Joined: Fri Dec 04, 2020 5:22 pm
- Has thanked: 1 time
- Been thanked: 3 times
Re: MCP23017
Hi,
My project also uses a TLC59116 LED driver, would it be possible to save the attached as a later version so I can view it please?
Thanks in advance.
My project also uses a TLC59116 LED driver, would it be possible to save the attached as a later version so I can view it please?
Thanks in advance.
- Attachments
-
- LED Driver i2c TLC59116.zip
- (3.39 KiB) Downloaded 335 times
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 686 times
Re: MCP23017
Hello,
Here you go. I'll investigate the WritePortPin problem for you and see if I can spot anything.
Here you go. I'll investigate the WritePortPin problem for you and see if I can spot anything.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel