Can anyone help regard programming a PIC16F18325

For anyone wishing to receive additional help with a project or simply looking to hire an embedded contractor we have a few contacts who would be more then willing to help.

Moderators: Benj, Mods

Post Reply
davidkilshaw
Posts: 18
Joined: Thu Dec 20, 2012 12:31 pm
Has thanked: 2 times
Contact:

Can anyone help regard programming a PIC16F18325

Post by davidkilshaw »

I have a requirement to take 2 bytes of information (a number from 0 - 1023) over I2c and provide a PWM waveform with a mark to space ratio of the number received.

I have managed to get the PWM to work in hardware to provide a PWM that is variable from a fixed register within the PIC but cannot get the I2C to be able to communicate with the Micro in hardware.

I want to achieve this a working hardware that is written in flowcode 8 so it can be amended easily moving forward.

Can anyone help in writing this software in flowcode 8

Any further questions please ask

Regards

Dave Kilshaw

User avatar
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: Can anyone help regard programming a PIC16F18325

Post by Benj »

Hi Dave,

Please can you post what you have so far so we can see what you have tried and suggest what you may need to do to get things working.

I take it you have looked at the examples here.
https://www.matrixtsl.com/wiki/index.ph ... 3e364f2eff

davidkilshaw
Posts: 18
Joined: Thu Dec 20, 2012 12:31 pm
Has thanked: 2 times
Contact:

Re: Can anyone help regard programming a PIC16F18325

Post by davidkilshaw »

I have looked at the wiki you suggest and have taken the code.

To describe the software

On boot the micro needs to do 3 things

Set 2 ports 1 high and 1 low ( done and working)
read the state of a digital input to be high or low. (if high it sets the i2C address to be A and if low sets the I2C address to be B (done and working)

Once this is done it needs to read a 2 byte number (0 - 1023) from the I2C address set in part 3 of boot up (not working)

This number is then used to set the mark space ratio of the internal 10 bit PWM in the micro. (this has been done with a variable and works)

After this point the PWM will continue producing the mark space ratio received until another value is sent oer the I2C address.

At present each block of code is written separately and once the i2C functionality is sorted then i can bolt them all together.

I have attached the I2C slave read block of code i have written but failed to get working. The port setting and delays are purely to flash an LED at different speeds to show where the code is in execution nothing more than that.

Thanks for your help so far

Regards

Dave Kilshaw

JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: Can anyone help regard programming a PIC16F18325

Post by JFinlayson »

I suppose you have this working now. I don't have this chip to test prog with. But included modified program based on what I have working.
The older the boy the bigger the toy

Post Reply