16f1939/16f1938 missing port interrupts
Moderator: Benj
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
16f1939/16f1938 missing port interrupts
on this device the port interrupts are missing(int on change), is there an updated .fcd file to correct this on the 16f1938 and 16f1939 chips? i have a 4 day weekend and it would be nice to be able to use these chips with the above potential
-
- Posts: 594
- Joined: Thu Sep 17, 2009 7:52 am
- Location: Belgium
- Has thanked: 63 times
- Been thanked: 102 times
- Contact:
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
hey spanish dude (cool name) i dont know anything about assembly or C language, thats why i got flowcode i was thinking about using the datasheet to configure the registers but since the port interrupt is not an option i dont see how it would do anything since i wouldnt have a place to draw an interrupt macro.... im probably way off course on my reasoning since i really dont know what im talking about only guessing really, can you explain your thinking, im interested in learning as much as possible with pic and flowcode
-
- Posts: 594
- Joined: Thu Sep 17, 2009 7:52 am
- Location: Belgium
- Has thanked: 63 times
- Been thanked: 102 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
Actually, I thought about the same issue... :/but since the port interrupt is not an option i dont see how it would do anything since i wouldnt have a place to draw an interrupt macro
Configuring the registers to enable the port interrupt shouldn't be that hard to write in C code, but you do not have an interrupt function to jump to.
I'm not good at modifying an FCD file (actually I never really tried, but looks a bit complicated ) but I may have a little workaround.
This is certainly not the best way to do it but it's the only idea I have right know .
Enable something like a timer interrupt or other interrupt just so you can access the interrupt macro.
Adding an if-statement to ONLY execute the interrupt macro when a PORT interrupt has been triggered.
Something like this :
if timer interrupt isn't triggered then
execute PORT IO interrupt code
else if timer interrupt triggered then
reset timer interrupt
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
hey spanish dude, i'll have to attempt that tommorrow, i havent done anything like that before, out of curiosity what chips do you use that have program memory around 28kb that work good with flowcode... im gonna buy some 18f2685's but at $12 a pop its a bit overkill with 96kb, i want to make a engine controller out of one of those, hopefully in v5 they have all this stuff cleared up
-
- Posts: 594
- Joined: Thu Sep 17, 2009 7:52 am
- Location: Belgium
- Has thanked: 63 times
- Been thanked: 102 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
The PICs I used so far are the 16F84A, 16F88, 16F877A, 18F2455 (24kbytes flash), 18F2550 (32kbytes flash) and 18F4455 (24kbyte flash).
I also have some 12F675 but I haven't used them yet.
I don't know their price. I can have free "samples" from microchip using my high school e-mail.
If you have an e-mail not ending with "hotmail", "gmail", ... you can ask for free samples too.
They usually take 1 or 2 weeks to get here but I saved a lot of money.
(The first time I bought a 16F877A from an electronics store I payed 12€ for it. That's a rip-off.)
The staff is working really hard on Flowcode v5 and I'm sure it'll be awesome.
Nicolas
I also have some 12F675 but I haven't used them yet.
I don't know their price. I can have free "samples" from microchip using my high school e-mail.
If you have an e-mail not ending with "hotmail", "gmail", ... you can ask for free samples too.
They usually take 1 or 2 weeks to get here but I saved a lot of money.
(The first time I bought a 16F877A from an electronics store I payed 12€ for it. That's a rip-off.)
The staff is working really hard on Flowcode v5 and I'm sure it'll be awesome.
Nicolas
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
thanks spanish dude, on second thought the 16f1939 and 16f1938 are the perfect chips for what i need, i tryed to do what you suggested with changing the registers but couldnt get it to work.... im hoping that matrix would see this post and fix these two chips for me to be able to use the port interrupts in the normal fashion, then i'll move up to the 18f4685..... something that i could do with equel result would be on hardware since i use 5 switches i could keep my switches hooked up to the pins they are on then run diodes from each switch to pin B0 which is an external int on edge, then in the int icon i could poll the position of the switches and use decisions to do the same thing, so when ever i would press a switch it would activate external interrupt on edge which would give me a harware port interrupt as long as the 800mv drop of the diodes does not keep me from getting a logic one on B0, ...but this is not my perfered method but should work the same
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
I would say 800mV is at the very top edge of logic 0. With low forward current involved the voltage drop of the diode should be a bit less than 0.8V.brandonb wrote: 800mv drop of the diodes does not keep me from getting a logic one on B0
If you want to play it save you could consider a Schottky diode instead?
at about 1mA the forward voltage drop should be less than 0.4V
These type of diodes are use to prevent transistors from saturating, and for clamping Voltages as near to supply voltage as possible.
Martin
Martin
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
thinking about it, i rigged up a circuit on the original pic flowbench with a 1n4004 diode to stop the injtectors, thats about the same thing as what i was talking about so im sure it will work until the problem is resolved, thanks martin, i didnt realize the logic 0 would be that high, you have me curious to do some testing to see what a 1 and 0 are in voltage and bytes
- 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: 16f1939/16f1938 missing port interrupts
Hello,
I will try and sort this out for you tomorrow morning. If you don't hear from me then something probably came up so keep posting on this topic to remind me. I think ioc on these devices was left out of v4 because they had advanced features such as separate registers for interrupt on rising edge and interrupt on falling edge for each ioc pin. These advanced ioc features are now fully supported in v5 simulation and code generation.
I will try and sort this out for you tomorrow morning. If you don't hear from me then something probably came up so keep posting on this topic to remind me. I think ioc on these devices was left out of v4 because they had advanced features such as separate registers for interrupt on rising edge and interrupt on falling edge for each ioc pin. These advanced ioc features are now fully supported in v5 simulation and code generation.
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
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
thanks ben, sorry for bugging you again it sounds like your a busy guy, that would be great if you could get that working for me, i do plan on buying v5 but wont be till january 20th
- 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: 16f1939/16f1938 missing port interrupts
Hello,
Right here are the updated FCDs with the port interrupts.
If you open the FCD into a text editor and then scroll down to the bottom then you will see the masks for the positive edge (iocbp) and negative egde (iocbn).
At the moment the full port is set to interrupt on any rising or falling edge.
Please note that the v4 simulation will ignore the mask values and only work with the upper nibble of PortB whereas the hardware should work correctly.
Right here are the updated FCDs with the port interrupts.
If you open the FCD into a text editor and then scroll down to the bottom then you will see the masks for the positive edge (iocbp) and negative egde (iocbn).
At the moment the full port is set to interrupt on any rising or falling edge.
Code: Select all
EnableCode="iocbp=0xff;\niocbn=0xff;\nst_bit(intcon, IOCIE);\n"
- Attachments
-
- 16F1939.fcd
- (11.69 KiB) Downloaded 200 times
-
- 16F1938.fcd
- (11.32 KiB) Downloaded 207 times
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
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
Re: 16f1939/16f1938 missing port interrupts
thanks ben, thats the trick, i tried it on b1 only and all is good, will have to get some more breadboards to fully experiment, upcoming projects are looking good with the files you helped me with,