Page 1 of 1
PIC10F322 - reading the TMR0 register value
Posted: Fri May 01, 2020 1:34 pm
by DeeJayOne
Hi everyone !
I try to read the TMR0 register value but it seems it doesn't work.
The value keeps always 0
My Cfg :
- Windows 10
- FlowCode v8.2.2.15 (2020-02-28)
Re: PIC10F322 - reading the TMR0 register value
Posted: Fri May 01, 2020 1:44 pm
by medelec35
You won't be able to read SFR values within simulation unless using Ghost hardware, E.g
Flowkit2 or
Multiprogrammer
It will work on your hardware i.e
will contain the value of
Re: PIC10F322 - reading the TMR0 register value
Posted: Fri May 01, 2020 2:17 pm
by DeeJayOne
medelec35 wrote:You won't be able to read SFR values within simulation unless using Ghost hardware, E.g
Flowkit2 or
Multiprogrammer
It will work on your hardware i.e
will contain the value of
Simulation will not work with any manually added C Code blocks.
It would be nice having a message in Flowcode which tell us this limitation !
Re: PIC10F322 - reading the TMR0 register value
Posted: Fri May 01, 2020 3:13 pm
by medelec35
medelec35 wrote:Simulation will not work with any manually added C Code blocks.
Sorry that's not totally true now with Flowcode V8
It can simulate C code blocks, but its using the conventional code like if() etc.
It can't simulate the code that's directly reading from the FSR.
With any software it normally list the things it can do.
It would be impracticable to list everything software can't do.
For example you seen the size of the latest PIC datasheets?
If its not listed on the information downloads or website and you want to do it then its always best to install a trial version or ask the question prior to installing.
Re reading SFR.
What I do is send the value via UART to A terminal program like Terra Term.
Or if not got Comms package send to LCD if enough pins are available.
Re: PIC10F322 - reading the TMR0 register value
Posted: Fri May 01, 2020 6:45 pm
by DeeJayOne
I don't understand Martin.
I have tried to follow this wiki article as example which speaks about "custom interrupt" :
https://www.flowcode.co.uk/wiki/index.ph ... -_PICmicro
As we can see, it seems there is a way to get directly values from PIC SFR.
So where is the trouble ?
Re: PIC10F322 - reading the TMR0 register value
Posted: Fri May 01, 2020 7:14 pm
by medelec35
That code is for reading from 16bit registers, you already know the code for 8 bits.
What I stated still applies:
medelec35 wrote:It can simulate C code blocks, but its using the conventional code like if() etc.
It can't simulate the code that's directly reading from the FSR.
So can only simulate generic C code and not PIC registers.
Custom interrupts and the following reading in to a Flowcode variable was solely for hardware and not for simulation.
I guess it would be better if that was stated within the text.
Re: PIC10F322 - reading the TMR0 register value
Posted: Sat May 02, 2020 8:56 am
by DeeJayOne
Thanks for the reply Martin
I have checked the wiki and it is not specified that it can't directly read SFR.
https://www.flowcode.co.uk/wiki/index.ph ... Simulation
PS : I had forgotten to activate the "C Simulate" feature by clicking on the icon.
I have well a message box which indicates that "TMR0" is not recognized.
Re: PIC10F322 - reading the TMR0 register value
Posted: Sat May 02, 2020 10:23 am
by medelec35
DeeJayOne wrote:"TMR0" is not recognized.
is related to
medelec35 wrote:So can only simulate generic C code and not PIC registers.
&
medelec35 wrote:You won't be able to read SFR values within simulation