PIC10F322 - reading the TMR0 register value

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
DeeJayOne
Posts: 17
Joined: Thu Apr 30, 2020 7:43 pm
Has thanked: 15 times
Been thanked: 3 times

PIC10F322 - reading the TMR0 register value

Post 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)
TMR0 - Settings.PNG
(12.79 KiB) Downloaded 430 times
TMR0 ISR (3024) - Crop - with Arrow.png
(91.04 KiB) Downloaded 430 times
Flowcode_PIC10F322_interrupt_tmr0.fcfx
(8.85 KiB) Downloaded 281 times
Last edited by DeeJayOne on Fri May 01, 2020 1:50 pm, edited 1 time in total.
Windows 10.0.18362.778
Flowcode v8.2.2.15 (2020-02-28)

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: PIC10F322 - reading the TMR0 register value

Post 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

Code: Select all

tmr0_value
will contain the value of

Code: Select all

TMR0
Last edited by medelec35 on Sat May 02, 2020 10:25 am, edited 1 time in total.
Reason: Deleted incorrect information.
Martin

DeeJayOne
Posts: 17
Joined: Thu Apr 30, 2020 7:43 pm
Has thanked: 15 times
Been thanked: 3 times

Re: PIC10F322 - reading the TMR0 register value

Post 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

Code: Select all

tmr0_value
will contain the value of

Code: Select all

TMR0
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 !
Windows 10.0.18362.778
Flowcode v8.2.2.15 (2020-02-28)

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: PIC10F322 - reading the TMR0 register value

Post 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.
Martin

DeeJayOne
Posts: 17
Joined: Thu Apr 30, 2020 7:43 pm
Has thanked: 15 times
Been thanked: 3 times

Re: PIC10F322 - reading the TMR0 register value

Post 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 ?
PIC Custom Interrupt - with arrows.PNG
(26.24 KiB) Downloaded 404 times
Windows 10.0.18362.778
Flowcode v8.2.2.15 (2020-02-28)

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: PIC10F322 - reading the TMR0 register value

Post 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.
Martin

DeeJayOne
Posts: 17
Joined: Thu Apr 30, 2020 7:43 pm
Has thanked: 15 times
Been thanked: 3 times

Re: PIC10F322 - reading the TMR0 register value

Post 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.
TMR0 - Simulate C error msg.PNG
(7.26 KiB) Downloaded 377 times
Windows 10.0.18362.778
Flowcode v8.2.2.15 (2020-02-28)

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: PIC10F322 - reading the TMR0 register value

Post 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
Martin

Post Reply