Menu

Word parsing?

Help
YT2095
2012-05-14
2013-05-30
  • YT2095

    YT2095 - 2012-05-14

    I`m having a lot of trouble trying to parse numbers bigger than 255,
    I`v tried the SysCalcTempx originally, and it didn`t work so I tried it manually here:

    Number = 255
           
            If Number >= 1000 Then
                Num1 = Number / 1000
                Number = number - (num1*1000)
            End If
           
            If Number >= 100 Then
                Num2 = Number / 100
                Number = number - (num2*100)
            End If
           
            If Number >= 10 Then
                Num3 = Number / 10
                Number = number - (num3*10)
            End If
           
            num4=number

    this code Should, be able to take a 4 digit number, and then parse these as individual digits that I can put into a display, but any number greater than the 255 show, screws everything up, for instance 256 displays 250.

    is SyscalctempX a 16 bit variable, it would be nicer to use that if it is?
    am i using the  casting correctly?
    basically I really cant see Why the above doesn`t work?

    help please! :)

     
  • mmotte

    mmotte - 2012-05-14

    look at the  lcd.h file for a good example in the "sub print"

    the lcd.h file is in the directory  \GCBASIC\include\lowlevel\lcd.h

     
  • YT2095

    YT2095 - 2012-05-15

    Thanks, I see where I was going wrong now, I didn`t put in the "Dim SysCalcTempX As word" line.
    I thought it was a Comment :)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.