Page 1 of 1

Newbie frustration.

Posted: Sun Aug 18, 2013 5:33 pm
by lungchard
Hello Forum,
Can you please help a new starter find a simple problem with his first attempts.
I want to read a PIC SFR (tmr1l) and display on LCD. My LCD shows some values that exceed 255.
Any idea why this may be happening? Should be 8 bits only.
Thanks in advance. Richard.

Re: Newbie frustration.

Posted: Sun Aug 18, 2013 5:44 pm
by dazz
HI
First off welcome, can you follow the link in my sig and sign up to the relevant forum as you will get more help ,can you also post your flowchart as you will get more help if someone can see what your trying to do in flowcode

Regards
Dazz

Re: Newbie frustration.

Posted: Sun Aug 18, 2013 5:53 pm
by lungchard
Hello Dazz,
I am registered forum member but posted here as it seemed to be best suited for my question.
What they need is a newbies section so we do not clutter the pro forum with trivia!
Have attached my attempt. It was originally posted on internet by Roman Black.
I have tried to copy it using flow code (original was in MikroC) but not been sucessfull.
Thanks for your time.
Richard.

Re: Newbie frustration.

Posted: Sun Aug 18, 2013 5:57 pm
by dazz
HI
i missed your were registered sorry
nothings trivial and every question is valid
can you link to the original code and a description of what it does so i can have a closer look

Regards
Dazz

Re: Newbie frustration.

Posted: Sun Aug 18, 2013 6:05 pm
by lungchard
Hello Dazz,
I will send original code.
I am just using it as a learning experience as it will be useful to me later.
In brief, i have declared a variable (RJH), then RJH=TMR1L then used lcd block to send it.
I get values but bigger than i expect.
The original code is more complex but you can see where i got my attempt from.
Appreciate your time.
Richard.

Re: Newbie frustration.

Posted: Sun Aug 18, 2013 7:10 pm
by Spanish_dude
That's strange ... Your RJH is an 8 bit variable and the TMR1L is 8 bit too.
Have you tried setting RJH to, let's say, 127 and see if it still shows values bigger than 255 ?

I don't see anything wrong in the code though...

- Nicolas

Re: Newbie frustration.

Posted: Sun Aug 18, 2013 7:31 pm
by medelec35
Hi Richard,
I know whats going on.
Your not clearing a space display after the last digit.
For example 1st value is 152
Then if the second sample is 68
since not printing " " after 152
then the display will show 682 even though it is a byte that has been printed (since the 2 will remain from the previous number).
Its just an LCD formatting issue.
I have attached a modified Flowchart.

If you need any further help then let us know.

Martin

P.s. since you now a registered V5 user, I will move this topic to a more suitable section of the forum :)

Re: Newbie frustration.

Posted: Sun Aug 18, 2013 9:09 pm
by dazz
HI
have a quick check of attached flowchart, you will have to work out the ccp and tmr 1, but most of c file converted to flowcode, you should be able to work out what goes where if you check the c and flowchart side by side ( timers and ccp im not very good at)

Regards
Dazz
tt.fcf
(10 KiB) Downloaded 357 times

Re: Newbie frustration.

Posted: Mon Aug 19, 2013 5:06 pm
by lungchard
Dazz/medelec35,

Thanks for the help.
Now working as i wanted.
One tip for the crib sheet i think.

Best Regards

Richard Hogan.

Re: Newbie frustration.

Posted: Mon Aug 19, 2013 5:33 pm
by Spanish_dude
medelec35 wrote:...
For example 1st value is 152
Then if the second sample is 68
since not printing " " after 152
then the display will show 682 even though it is a byte that has been printed (since the 2 will remain from the previous number).
Its just an LCD formatting issue.
...
How did I not see that... *facepalm*

- Nicolas