IOC dilema

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Lord Grezington
Flowcode V4 User
Posts: 287
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

IOC dilema

Post by Lord Grezington »

Hello All

There is a part of a program (in FC8) on a 16F18344 where all I am doing is using an IOC pin (C2) which just has few pulses coming in. All I am doing is duplication this pulse onto another pin A1. However, for some reason I am getting very short drops in the positive pulses, anyone have any idea's why? The IOC interupt is called near the start of the main program and does not include any other pins and triggers on both edges (there are no other interupts in the program).

Thanks
IOC 3.jpg
IOC 3.jpg (37.92 KiB) Viewed 2242 times
IOC 2.jpg
IOC 2.jpg (69.41 KiB) Viewed 2242 times
IOC 1.jpg
IOC 1.jpg (83.87 KiB) Viewed 2242 times

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

Re: IOC dilema

Post by Benj »

Hello,

To discount anything in your program causing the problem can you disable the other code or at least add a while 1 loop so that it enables the interrupt and then loops forever in main without doing anything else.

I'm thinking maybe an ADC read on that pin or something else similar is maybe switching the pin to an input temporarily.

stefan.erni
Posts: 591
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: IOC dilema

Post by stefan.erni »

Hi Lord Grezington

Disable the NO Output and take a mesurment. If the Pin A1 still goes down, something switch it down (what Ben says)
If it is stable always 1 then you have a IOC problem.(maybe)

regards

Stefan

Lord Grezington
Flowcode V4 User
Posts: 287
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: IOC dilema

Post by Lord Grezington »

Thanks Ben & Stefan

Yes, its looks to be the analogue input! How/Why is the analogue input affecting the IOC though when the analogue input is is the main program? Will the anlalogue input (RC4/AN20) still affect the IOC on RC2 just because its on the same port?

I am guessing I need to change RC2 to a general IO and not an analogue input to resolve this problem? I have had a look into the datasheet and I cant seem to find the right register to make the change. Apparetnly the datasheet file size is too large to upload, so here is a link. https://www.google.com/url?sa=t&rct=j&q ... 5_RWBJCBDw

Thanks

Lord Grezington
Flowcode V4 User
Posts: 287
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: IOC dilema

Post by Lord Grezington »

Sorry to push

I have shown the ADC is the affecting the IOC, so how to I stop it from doing it?

Thanks

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

Re: IOC dilema

Post by Benj »

Hello,

Not sure how to help any further. I would probably need to see your project to offer any further advise. You can send via a PM if you do not want it to be made public. Ideally you can strip the file back to the basics that show the problem then this would be very helpful in terms of making sure we see the wood for the trees.

Lord Grezington
Flowcode V4 User
Posts: 287
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: IOC dilema

Post by Lord Grezington »

Thanks Ben

I have stripped the program back to bare basics, I now no longer even have the input pulse but still getting a strange output. FC program is attached and the output is below.
IOC ADC Issue.png
(55.67 KiB) Downloaded 1873 times

Thanks
Attachments
IOC ADC Issue.fcfx
(15.82 KiB) Downloaded 59 times

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

Re: IOC dilema

Post by Benj »

Hello,

If you add a delay into the loop then does this change anything in terms of wierdness? Just looking at the CAL code for the ADC (pin C4 - ADC20) and it all seems to check out.

To sum up your various connections.

You have interrupt on pin C2.

C1 is an analogue input - InputVoltage
C3 is an analogue input - Current
C4 is an analogue input - POT
C6 is an analogue input - Analogue

PWM and PowerOut are both PWM components that are assigned to different pins but both use the same PWM channel.

Have you looked at the errata document for the chip on the Microchip website to see if it is a known silicon bug?

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1200
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Contact:

Re: IOC dilema

Post by QMESAR »

Hi.
I haven't studied your device datasheet but recall had a similar situation make sure if the pins you are using is also connected to the comparators
make sure you switch the comparators OFF :D

Post Reply