post is duplicated....
post is duplicated....
Last edited by astanapane; - 27th August 2020 at 17:36.
noDoes it matter that SFR are commented in the pic18f46k22 pbpinc?
if configured correctly you won't get errorsI have tried the new inc and got the following errors. (used PIC18f46k22)
Is there a way i could fix those?
Warning I'm not a teacher
IT needed a tweak to work for a 18f26k22
Warning I'm not a teacher
Richard thanks,
tested and confirmed that is working.
I have tested only the small font 7x5_18 as text.
I'm trying to figure out how to display a variable.
tested with big fonts as well.
it is really easy to use it like that.
Richard is there a way to print variables other than text?
doesn't the demo show that with the contrast and backlight stuff ?
what have you tried ?
Warning I'm not a teacher
I havent tried the demo. Just download the txt.
As far as i understant it is using the command
ARRAYWRITE BUFF [dec C,0]
LCDSTR x,y, buff
i tried and it worked.
a = 1
b = 2
c = a+b
Last edited by astanapane; - 29th August 2020 at 10:03.
have you read the pbp manual and understood the syntax for
Output Modifiers for Formatting Strings using arraywrite ?
its all there
Warning I'm not a teacher
Hi Richard,
my fault, yes i have read the arraywrite - arrayread command and corrected the code in my previous edited message.
Many thanks.
i have a question regarding the library and the code for the nokia 3310.
for the following code:
VAR1 is a byte and VAR2 is a byte as well. Those two numbers are presenting the Speed in format VAR1,VAR2 (where VAR1 can be any number from 0 to infinity, and VAR2 can be any number from 0 to 99)Code:ARRAYWRITE speed [dec var1,dec2 var2,0] LCDSTR x,y, buff
In case that the VAR1 gets the variable from 0 to =<255 the it can be used as a byte.
My problem is that i need this floating number for ex. speed = 50,86 to get it as an integer speed = 5086. May i have your help please?
If i set speed (VAR1 VAR2) as word then the following command
does not accept word.Code:LCDSTR x,y, speed
Could you please help me to get the speed as an integer and read it as it is.
For my program i'm testing:
thanks once again.Code:if speed is > 5086 then limit ; 50,86
Last edited by astanapane; - 4th September 2020 at 10:18.
i will start here
you do it exactly the same way as for a lcd displayMy problem is that i need this floating number for ex. speed = 50,86 to get it as an integer speed = 5086. May i have your help please?
Code:buff var byte[6] ; 4dig+dp+null speed var word ARRAYWRITE buff,[dec2 speed/100,".",dec2 speed//100 ,0] LCDSTR x,y, buffcorrect lcdstr str buffer var ,const strLCDSTR x,y, speed
does not accept word.
from the inc file
;################################################# #################
USERCOMMAND "LCDC" ;X,Y,CHR 0 < X < 84 , 0 < Y < 7 , 31 < CHR > 127
USERCOMMAND "LCDCLR" ;clear LCD
USERCOMMAND "LCDSTR" ;STRING @ X,Y or Constant String
USERCOMMAND "LCDCMD" ;cmd BYTE TO LCD
USERCOMMAND "LCDDAT" ;DATA BYTE TO LCD
i might preempt the next question
leading zero's and right justifying fields
http://support.melabs.com/forum/picb...strtok-usercmd
Last edited by richard; - 4th September 2020 at 11:03.
Warning I'm not a teacher
im not in front of the circuit and computer in order to test it.
i havent done it as it following /100 and //100 (remainder)
I have used it with "." like the following in the loop and i get it right on the LCD as 50,86 for example. :Code:buff var byte[6] ; 4dig+dp+nullspeed var word ARRAYWRITE buff,[dec2 speed/100,"."dec2 speed//100 ,0] LCDSTR x,y, buff
I need on the screen the right "floating" value.
then i send the code to sub labelCode:ARRAYWRITE speed [dec var1,".",dec2 var2,0] LCDSTR x,y, speed
speedlimit:
and i havent used "."
i sent the command like:
having that it was not possible to use speed as word.Code:ARRAYWRITE speed [dec var1,dec2 var2,0]
makes no sense to mei sent the command like:
Code:
ARRAYWRITE speed [dec var1,dec2 var2,0]
having that it was not possible to use speed as word.
ARRAYWRITE speed
speed must be an existing chr array big enough to contain the text generated plus a null terminator
a word var could hold only 1 chr safely ,since pbp checks nothing anything could get clobbered by misuse like that
Warning I'm not a teacher
now it makes sense why i was getting some messy chr on the screen like that.
i've tried the following but didnt work.
Code:rbuf var byte wbuf var word
then i tried:Code:checkt: arraywrite RBUF,[DEC2 speed1/100,DEC2 speed2//100,0] ; for example speed1 = 56 and speed2 is 85 LCDSTR 0,2, RBUF ; ----------> this gives 0085 wbuf = rbuf if wBUF > 5685 then gosub limit return
how is it possible to combine those two speed1 and speed2 vars in one var? and check then the result as an integer number?Code:checkt: arraywrite RBUF,[DEC speed1,DEC2 speed2//100,0] ; for example speed1 = 56 and speed2 is 85 LCDSTR 0,2, RBUF ; ----------> this gives 5685 which is what i want....BUT!!!! when i try to check if wbuf > than 5685, it doesnt work wbuf = rbuf if wBUF > 5685 then ' IF THE TEMPC IS GREATER THAN 37 C THEN LIGHT UP THE BLUE LED high lata.0 ELSE low lata.0 endif return
You have only declared "rbuf var byte" It is being used as a pointer as far as I can see. It will be NO LARGER than 255.
Dave Purola,
N8NTA
EN82fn
Hi dave,
i solved it.
i used the rbuf as var word
Then i didnt add the commands for
i used the above command only to combine it with the following and present the number to the lcd.Code:arraywrite rbuf,[dec speed1,dec2 speed2,0]
So the solutions for me is:
Thanks a lot for the help all of you.Code:checkt: RBUF = (SPEED1*100) + SPEED2 IF RBUF > 5682 THEN ; THIS IS JUST AN EXAMPLE GOSUB LIMIT RETURN
Last edited by astanapane; - 4th September 2020 at 18:23.
additional missing line from the previous message
i used the above command only to combine it with the following and present the number to the lcd.Code:arraywrite rbuf,[dec speed1,dec2 speed2,0]
in any case the solution is to use the rbuf as word, multiply by 100 the speed1 and add speed2.Code:LCDSTR x,y, rbuf
has not solved it at all , you cannot safely use arraywrite rbuf,[dec speed1,dec2 speed2,0] with a word var as the destinationi solved it.
i used the rbuf as var word
the destination for the text chrs generated by arraywrite must be an existing chr array big enough to contain the text generated plus a null terminator
not doing so will lead to enormous problems
secondy to expect the result of arraywrite to be usable as a number is absurd , its a textual chr string
Warning I'm not a teacher
there is a missandestanding. my fault because i consfused you by using the same name for the variable SBUF and RBUF in the previous posts.
vars.....
SBUF var byte
RBUF var word
Program in the main loop includes the command:
then there is a checkSpeed LABELCode:arraywrite SBUF, [dec speed1, dec2 speed2,0] ;
checkSpeed:
And that is what it works for me. It is under testing for a day now, and havent seen any strange behaviour.Code:RBUF = (speed1*100) + speed2 if RBUF > 5687 then; just an example gosub limit endif return
thanks.
SBUF var byte
sadly still woefully incorrect.
that reserves 1 byte , you need at least 5 bytes
Warning I'm not a teacher
well done!
you have proved yet again that code snippets are generally useless time wasters..
this time with the nice added touch of posting snippets that bear no semblance to
the code actually employed. a touch of genius . not
don't know why i bother
Warning I'm not a teacher
Thanks for any help.
please try to be gentle. Life is small and there are lots of good people out there.
Have a nice day.
Good day to all.
I have two questions. One is related to this amazing library shared by Richard and the other one is related to a small project i have.
1. May i add a picture to nokia LCD via the usercommand LCDDAT?
For image data could i use the GLCD from Miktoelektronics?
2. Im working with some speed values. So range can be from 0 to infinity.Code:;################################################################## USERCOMMAND "LCDC" ;X,Y,CHR 0 < X < 84 , 0 < Y < 7 31 < CHR > 127 USERCOMMAND "LCDCLR" ;clear LCD USERCOMMAND "LCDSTR" ;STRING @ X,Y or Constant String USERCOMMAND "LCDCMD" ;cmd BYTE TO LCD USERCOMMAND "LCDDAT" ;DATA BYTE TO LCD
How could i catch/retreive the highest value from a Variable? Is there any specific way - path to do that?
thanks.
Can you define infinity please?
Your variables can be: bit (0-1), bytes (0-255), word (0-65535) and long (-2147483648 to 2147483647)
Ioannis
Hi Ioanni, thanks for the reply.
Speed is not going to exceed any value more than a logical speed targeting to a bicycle or a car. In that case as i understand we could use "word" variable.
But there is no specific value as a limit. It can be any possible number that a variable may have.
thanks in advance.
Maybe the MAX operator can do what you want.
Your check loop can be something like this:
max_value = old_speed MAX speed
old_speed = max_value
But this will lead eventually to a top value on max_value and you may have to reset this value. Don't know what you try to accomplish but a periodic reset may be needed.
Ioannis
Thanks Ioanni,
i will try the MAX operator.
What i'm trying to export is the maximum speed value of a single run.
As i'm not in my home computer right now i will try your advice later today.
Many thanks.
i did look at the array generated by Mikroelektronics glcd bitmap generator andFor image data could i use the GLCD from Miktoelektronics?
it seems i rejected it for that generated by lcdassistant, cannot recall why.
none of my posted examples use mokroe files . they would all need a bit of
work to leverage into pbp anyway
the LCDDAT sends 1 byte to the lcd @ the current cursor posn1. May i add a picture to nokia LCD via the usercommand LCDDAT?
it would not be the most efficient way to upload an image.
i saw no way to read pixel data back from the display so i decided that the only way to
create a decent bitmapped image function was using a frame buffer. this i have implemented
in the c version as posted.
implementing this function in pbb is not something i'm willing to invest the time into
Warning I'm not a teacher
I know 3310 LCD is the cheapest graphic LCD one can buy, but the effort to display something is too much relative to the result (B/W bitmap).
Next best solution is the Nextion 2.4" at about 15 euros, 65536 colors, 4MB memory, 320*240 and touch with RS232 control.
No MCU load to control the display and feedback with touch (no hardware buttons etc).
Richard did an exceptional job on 3310 but is it worth anymore with the cheap smart displays?
Ioannis
Bookmarks