Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LCD without zero-Mikrobasic code for radio frequency control

Status
Not open for further replies.

aduri

Newbie level 4
Newbie level 4
Joined
Jul 9, 2006
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,329
LCD without zero

Hello,
This code (Mikrobasic) converts an analogical value in a binary for a radio frequency control.


This's the code:

Code:
cod_fine:
  byteAdcbin1 = Dec2Bcd16(ValoreAdc1)  ' conversione da decimale a binario
     if (ValoreAdc1 =0) then portb=255 'led or contraves on pins 32 to 40
         else
             if  (ValoreAdc1<100)  then    portb = not byteAdcbin1
             end if
     end if

       if (ValoreAdc1 >99) then ValoreAdc1 =99  '
       end if
           if (ValoreAdc1<10) then LCD_out(1,11,"0")      '
           end if
     bytetostr(ValoreAdc1,txt1)
     LCD_out(1,10,txt1)

This is my problem:


When the value is lower than 10 (e.g. 9), I'd like the LCD to visualise the number 09
I tried with the IF code, but it doesn't work.

Ciao
Antonio
 

Re: LCD without zero

Your "0" is getting overwritten by your final LCD_out statement.

Try modifying the string txt1 before you output it:
Code:
     bytetostr(ValoreAdc1,txt1) 
     if (ValoreAdc1<10) then txt1[1] = "0"
     endif
     LCD_out(1,10,txt1)
 

    aduri

    Points: 2
    Helpful Answer Positive Rating
Re: LCD without zero

Thank you,
I solved with your code.

Ciao
Antonio
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top