16F883 Timer 1 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

bwynne
Posts: 6
Joined: Sat May 08, 2010 10:27 pm
Contact:

16F883 Timer 1 problem

Postby bwynne » Fri Jul 30, 2010 10:31 pm

Hello, please can you help me.
I have attached my flowcode 4 file that i cant get to work with timer1.
I am trying to initialise timer1 to be free running, then read timer 1 value and make it into an integer ( SHORT ) value, then use an If statement to check if it has exceeded a value.
I have not had any luck so far ! please can you help.Attachments
inj_drive1b.fcf
Attachments
inj_drive1b.fcf
(6 KiB) Downloaded 86 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8223
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2351 times
Been thanked: 3335 times
Contact:

Re: 16F883 Timer 1 problem

Postby medelec35 » Sun Aug 01, 2010 9:24 am

Hello bwynne.
The problem is with your configuration settings which cam be accessed via 'Chip', 'Configure...' menu. then 'switch to Expert Config Screen'
I have changed watchdog to off (since was switched on, with no clear watchdog commands your program would be permanently resetting if osc type was correct)
Osc type to HS,
Disabled low voltage programming.
Now to your coding.
After changing your settings, program is working OK.
Leaving timer 1 with the settings you have, means timer increments by 1 approx every 1.63uS. so 1.63 x10-6 x 8000 = 13ms therefore C5 will toggle every 13mS, so it will look like port is permanently on, since frequency is approx 1/(13x10-3 * 2) = 38 HZ

Is there a reason your not using the interrupt components, then putting the decision branch within the interrupt macro?
I am asking because it is so much easier than C.
But if you want to keep using C, or leaning C then I can totally understand.

Another thing, I noticed that you will need to activate your license. When you do that it is best to right click on Flowcode and Run as administrator.

Also you are using 16F883 target. They are good value for money since have two pwm channels and EEPROM etc, but thet can be very fussy when programming. A few time after I send program to chip, I get a 'cannot ID target' (it is much more fussy with pickit2, if you want a good ICSP, then Asix presto programs those chips 100% first time)
Hope this helps.
Attachments
inj_drive1b_Modidfied.fcf
(6 KiB) Downloaded 84 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

bwynne
Posts: 6
Joined: Sat May 08, 2010 10:27 pm
Contact:

Re: 16F883 Timer 1 problem

Postby bwynne » Mon Aug 02, 2010 10:04 pm

hello medelec35,
Many thanks for your help.
I have still not managed to get the software to compile the code !

Please see the error below:
File name: C:\Users\barry\inj_drive1b_Modidfied.c
Generated by: Flowcode v4.2.3.58
Date: Monday, August 02, 2010 23:07:54
Licence: Professional

***UNREGISTERED***


http://www.matrixmultimedia.com


Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F883 "inj_drive1b_Modidfied.c"
BoostC Optimizing C Compiler Version 6.95 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Compiler can not be started without a host program (code 120)


Return code = 120

Flowcode was unable to compile the flowchart's C code due to the following errors:


If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.

FINISHED


I have run in admin mode, and also tried to register my professional version of flowcode 4, without sucess.

The flowcode security seems to be very tight and difficult to enable your code even though you have bought the software from Matrix !

i a just getting frustrated !

i have a working Diesel injector software that i wrote in C. I need to convert it to flowcode 4 !

Best Regards
Barry.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8223
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2351 times
Been thanked: 3335 times
Contact:

Re: 16F883 Timer 1 problem

Postby medelec35 » Mon Aug 02, 2010 10:34 pm

Hello Barry. it compiled for me ok, and was running it on my EB006 programmer.

I did get same error as you once. Re-booted pc, and then worked ok form then on.

You tried re-booting?

I believe you only get a temporary time limited code sent until actual full normal code arrives, maybe your passed the date deadline.
If benj or steve at matrix read this then hopefully they would be able to assist you further.

I have downloaded the attachment just to check, and it compiles with no errors.
I have attached the hex code for you to upload to chip, not sure if you will find it helpful.
Hope it gets sorted soon.
Attachments
inj_drive1b_Modidfied from dl.hex
(1.04 KiB) Downloaded 68 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
DavidA
Matrix Staff
Posts: 1053
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 56 times
Been thanked: 273 times
Contact:

Re: 16F883 Timer 1 problem

Postby DavidA » Tue Aug 03, 2010 8:35 am

Hello Barry,

Could you either PM me or fill out a web contact form here:

http://www.matrixmultimedia.com/contact2.php

So I can help you with this via email.

bwynne
Posts: 6
Joined: Sat May 08, 2010 10:27 pm
Contact:

Re: 16F883 Timer 1 problem

Postby bwynne » Tue Aug 03, 2010 11:38 pm

Hello medelec35 ,
i finallty managed to register my flowcode 4, and compile correctly .
My target system, is a Diesel Injector Drive PCB, that i designed. I have working C code, that i wrote and download and run OK, using my ICD2 from microchip.

The Flowcode 4 exapmple, that you have looked at, i have now compiler OK to Hex and then programmed with my ICD2, BUT it does not appear to run on my target. ( swap to my C code, and all runs OK ).

The flowcode 4, does not seem to have simulation support for the timer1 ?

Also, there is a problem with the 16F883 part, please see attached note from Microchip. My PCB is OK with this microchip errata.

Not sure why i cannot run the software on my target ?

Barry
Attachments
16f883 debug errata.txt
(5.97 KiB) Downloaded 80 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8223
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2351 times
Been thanked: 3335 times
Contact:

Re: 16F883 Timer 1 problem

Postby medelec35 » Wed Aug 04, 2010 6:09 am

medelec35 wrote:but thet can be very fussy when programming. A few time after I send program to chip, I get a 'cannot ID target' (it is much more fussy with pickit2, if you want a good ICSP, then Asix presto programs those chips 100% first time)
Hope this helps.

I have raised a ticket with microchip out using there PICkit programmer (and other programmers including EB006) not able to successfully program these chips. After a while you think the chip is damaged due to constantly not recognising target etc, but then when use presto programmer it then always programs. If it does not program then I would assume there would be a problem running ICD.
you are correct about Timer 2 not simulating, it can be a headache. Normally I would suggest ICD with EB006, bit if target not recognised you will struggle. Only other thing i can suggest is to compile to hex and use a different simulator.

Re: Flowcode version not running. Would you like to post verison not working, along with the hex file?

@Wizards in Matrix Multimedia. Not blaming programmer since it programs all other chips without any issues and pickit2 has same problem. Would you have any ideas on getting around this please?
I have read pulling RB3 down via 10K resistor could solve issue, but does not.
Thank you
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8223
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2351 times
Been thanked: 3335 times
Contact:

Re: 16F883 Timer 1 problem

Postby medelec35 » Sun Aug 08, 2010 10:00 am

Thank you bwynne.
What you have posted is very useful information, and I have forward it on to microchip.
With the 16F883, if you use internal osc, then it does not go into programming mode with some programmers, if MCLR is not external!
Any luck with running your code?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8223
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2351 times
Been thanked: 3335 times
Contact:

Re: 16F883 Timer 1 problem

Postby medelec35 » Tue Aug 10, 2010 10:10 am

Update:
Received a message from Microchip
Yes internal MCLR and internal OSC is a known issue with some of the Microchip programmers. Personally I don't know why some programmers have the limitation and others don't. So from that point of view I can send a request to the development tools group to update the firmware, if possible. The problem is I think the priority will be for newer tools such as PICKit3 so I wouldn't expect a quick fix for PICKit2. The current "workaround" for using internal MCLR and internal OSC is to place a delay at the start of the code, approx. 20ms. For example you will probably notice if you program in the config settings only with program memory blank you will not see the issue.


The worst offender is PICkit 2. This problem can also show with EB0006.

Not had anymore programming issues since added delay before OSCCON, so fix appears to work sofar.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.