Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Successful simulation of Capture/Compare register in PIC18 series

Status
Not open for further replies.
SNAP! :D

i was just reading up on that exact chip!

However my thoughts are, if we had trouble getting the timer to SIMULATE on MPLAB, will we not encounter the same issue with a different chip...

Its not like we put the program on the processor and then we encountered problems. Wouldn't that point to an inherent problem with MPLab, and if thats the case. How would a new processor eliminate the issue..
 
Yep... Its MPLAB


This is what I have running at the moment

[MODNOTE]Code removed by request from the OP[/MODNOTE]

This simulates in ISIS perfectly RP0 is the trigger TMR1 is loaded into CCPRx when the RP0 is fired..
 
Last edited:
Never used ISIS before but looks like I'm going to have to get myself a copy and get familiar rather quickly.

Thanks so much for your guidance, incidentally is ISIS just a simulator/debugger or will it allow me to load the software onto the PIC just as MPLab would.

Additionally, just out of curiosity I'm going to try running the same code in MPLab but with the include file for a different micro just to see if it cooperates
 
ISIS is extremely good but expensive.... It'll cost a minimum of £150 for the basic simulator... If you want to sim pic18's it will be £295...

Mine cost me a hell of alot more, but I use it to the hilt....

The best way is to get capture running as you need on a simple pic18f4520... Once the basics are done then its just pin mapping... ( That works pretty well so it should be a doddle getting it to work for real ).
 
Hi Ian

I am trying to get my head around ISIS, i am almost there but am having an operational issue which is something to do with an operational oversight of mine but i cant figure it out.

Using the code above..

I have selected my Micro (the same one specified in the code) attached the HEX file to it so that the machine code is recognised by the micro, attached the source code in the .asm format, (both written in/generated by MPLAB)

but i keep getting the same list of errors, which clearly cant be because the code compiles and runs fine as you know, and i have verified the same in MPLAB (although it does not capture when using the stimulus workbook but we already knew that!)

a warning/error on every line what am i doing wrong?

Screen Shot 2013-02-11 at 12.53.35.png
 
UPDATE**

ok so, ive found that if i remove the source file and just have the hex file attached as a program file i can get a successful build

but if i add the source file i can't, which means i cant debug by walking through and 'stepping into' each line of code one by one, also i don't know how to trigger an input to a pin in order to simulate a stimulus
 
Thanks,

the .HEX file didn't work but the .cof file did,

Though with the button it seems like the timer does hold a value but fails to update..

Theres no reason i can see that the processor seems to be in reset continuously according to the simulation log

Screen Shot 2013-02-11 at 14.16.17.png
 
:D finally... should've spotted that!
Its working fine now and actually allowing me to walk thru the code! The CCP1 register isn't updating (says disabled in the watch window) but the timers are doing what they should, so im going to go thru the code snippet again. Thanks!
 
The include directive in your code stated the PIC18F25J50 so thats the one im using, not the 18f26..

when you say

As this has a USB and proteus takes a bit of time to initialise and finish..

are u referring to the speed at which the registers will be updated?
 
Sorry I was at work....

with the greatest of respect, please dont ever apologise to me again :) i cant thank you enough

even when i regain control of ISIS the values fail to change from their initial value, i have the button tied to VDD too for the input voltage and definitely input on the RA0 pin, no change, im just going over the remappable pin section of the data sheet to see if there is some kind of code error in that department.

This is the arrangement im using at the moment

Screen Shot 2013-02-11 at 19.31.33.png
 
Are you using the same code as I (accidentally) posted?

Incidentally... You need a pullup and switch to ground..

Capture.png


Mine has stopped just after the loop and filled the CCPRx register... After the button press.
 
yes I'm using exactly the same one, i figured i would make sure I've got to grips with the program using a code that i know is working.
That way i don't need to worry if the errors are with the code or with my knowledge of ISIS.

Ill give it a try with the pull-up now
 
it doesnt seem to make it passed the first capture stage, meaning it isnt reading the input on the RA0 pin.

Even with identical codes and now circuitry.
Screen Shot 2013-02-11 at 20.23.06.png

it does strike me that your additional pins 21-24, are seem to be showing a blue square (which i assume is a low logic) which would be correct but mine are showing a mixture,
im thinking there may be some configuration bits setting that im unaware of, that may also explain the warning messages that i get too
 
Thanks so much, i believe that is the last piece of the puzzle,

But as i search in my component library all of the PICMicros are written in the same format PICxxFxxxx, instead of PICxxFxxJxx, there doesn't seem to be any options with remappable pins

certainly not in component mode and 'P' (pick devices). I'm just wondering if there is another directory for them or is my library just not as extensive. The list is exhaustive, just limited to the standard range it seems...
 
Status
Not open for further replies.

Latest threads

Back
Top