pic12F1840 incomplete fcd and wake from sleep problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
ocaltek
Posts: 8
Joined: Tue Feb 01, 2011 6:03 am
Has thanked: 2 times
Contact:

pic12F1840 incomplete fcd and wake from sleep problem

Post by ocaltek »

Hi All

No longer a NOOB but no flowcode guru either. I have been having alot of problems with the timer0 interrupt properties. Also the portB interrupt icon has not got any properties available. I have downloaded a new fcd file from another post about timer1 on this chip which helped tmr1 but not the port enable. Any help would be greatly appreciated. I did modify the fcd file to change the portb option see before and after below (compiled with no errors) I tried setting the the individual pin bit (IOCAN register) by c code window with no effect.

Code: Select all

 //C Code
	//C Code:
	
	{

	st_bit(iocan,IOCAN1);
	}
FROM
[PORTB]
Name="PORT"
FlagReg=
FlagBit=
HandlerCode="#ifndef MX_INTHANDLER_intcon_RAIF\n#define MX_INTHANDLER_intcon_RAIF\nchar mxtmp;\nif (ts_bit(intcon, RAIF) && ts_bit(intcon, RAIE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tmxtmp=porta;\n\tcr_bit(intcon, RAIF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n"
UseExplicitHandlerCode=1
UseExplicitEnableCode=1
EnReg=
EnBit=
EnableCode="st_bit(intcon, RAIE);\n"
DisableCode="cr_bit(intcon, RAIE);\n"
OptCnt=0


TO
[PORTB]
Name="PORT"
FlagReg=
FlagBit=
HandlerCode="#ifndef MX_INTHANDLER_intcon_IOCIF\n#define MX_INTHANDLER_intcon_IOCIF\nchar mxtmp;\nif (ts_bit(intcon, IOCIF) && ts_bit(intcon, IOCIE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tmxtmp=porta;\n\tcr_bit(intcon, IOCIF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n"
UseExplicitHandlerCode=1
UseExplicitEnableCode=1
EnReg=
EnBit=
EnableCode="st_bit(intcon, IOCIE);\n"
DisableCode="cr_bit(intcon, IOCIE);\n"
OptCnt=0




Im using flowcode version v4.5.18.74 Thanks in advance.

Cheers

Christian
FLASHING LED'S FANTASTIC!

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: pic12F1840 incomplete fcd and wake from sleep problem

Post by Benj »

Hello Christian,

I have just checked and these issues have been resolved in v5.

Your port interrupt FCD code looks to be correct but is missing the masks.

If you want to be able to select the Port Interrupt pins in v4 then you will need to use a C code icon just before the interrupt enable icon to set the pin mask.

iocap=0x3F;
iocan=0x3F;

The first value controls interrupt trigger on rising edge and the second controls interrupt trigger on falling edge.

The 0x3F sets port pins 0 through to 5 as interrupt sources, 0x01 would allow pin 0 only.

Note that FC 4 will be unable to simulate the port interrupt. This has also been fixed in v5.

ocaltek
Posts: 8
Joined: Tue Feb 01, 2011 6:03 am
Has thanked: 2 times
Contact:

Re: pic12F1840 incomplete fcd and wake from sleep problem

Post by ocaltek »

Hi Ben

Thanks for the help. Your solution compiled fine but would not work on hardware. Going through the C and asm file showed no issues all addresses were correct and the op-codes were right just would not function didn't matter what pin was pulled low would not interrupt. I have made a compromise. To do something that looks like sleep with out sleep mode. I guess I will have to upgrade to V5. Its very odd as I have used the same type of functions in a 16f series processor with no problems what so ever. Thanks again.

Cheers

Christian
FLASHING LED'S FANTASTIC!

Post Reply