String of characters(array) to decimal value


+ Reply to Thread
Results 1 to 21 of 21
  1. #1
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default String of characters(array) to decimal value

    Hello everyone, I was wondering if there is a way to convert a character to decimal value.
    Code:
    ArrayWrite myArray, ["Hello"]
     for i=1 to 5
            dec_value =  myArray[i] ' is there a way to convert this to a decimal?
     next i
    So that I will have the following...
    1. dec_value = 72 ' H
    2. dec_value = 101 ' e
    3. dec_value = 108 ' l
    4. dec_value = 108 ' l
    5. dec_value = 111 ' o

    Thanks ,
    tacbanon

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,316

    Default Re: String of characters(array) to decimal value

    When you do myArray[0] = "H" the ASCII code for 'H' (which is 72) will be what ends up in the variable. If you want to display it as a decimal number on a LCD or UART then use the DEC modifier:
    Code:
    LCDOUT $FE, 1, DEC myArray[0]
    myArray[0] = "H"
    myArray[0] = 72
    myArray[0] = %01001000
    myArray[0] = $48

    All of the above are equal - it's just different interpretations of the same thing, in this case the decimal value 72.

    /Henrik.

  3. #3
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Hello Henrik, thank you so much for replying. Sorry for not being clear..I want the value to be use in a SELECT CASE..

    Code:
    Select Case  dec_value
    case "H"
    Serout PORTC.6, T9600, ["H", 13] 
    case "e"
    Serout PORTC.6, T9600, ["e", 13] 
    case "l"
    Serout PORTC.6, T9600, ["l", 13] 
    case "l"
    Serout PORTC.6, T9600, ["l", 13] 
    case "o"
    Serout PORTC.6, T9600, ["o", 13] 
    case "W"
    Serout PORTC.6, T9600, ["W", 13] 
    ......
    END SELECT
    Regards,
    tacbanon

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,316

    Default Re: String of characters(array) to decimal value

    I don't understand the problem...The code in your first post should work just fine and so should that in your latest post - have you actually TRIED this or are you just thinking to much ;-)

    myArray[0] = "H"

    If myArray[0] = "H" THEN...
    or
    If myArray[0] = 72 THEN...
    or
    If myArray[0] = 001000 THEN...
    or
    If myArray[0] = $48 THEN...

    Same thing as in my previous response - they are all the exact same thing just expressed in different ways.

  5. #5
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Okay I'm a little confused...the following is what I'm actually trying to make it work..
    Code:
    porta=0  :  portb=0  :  portc=0  :  portd=0
    trisa=0  :  trisb=0  :  trisc=0  :  trisd=0
    porte=0  : trise=0
    harf_reg var byte
    adres_sec var byte
    yinele var byte
    sutun_reg var byte[300]
    veri var byte
    yazi_reg var byte 
    i VAR BYTE
    x var byte
    z var byte
    y var byte
    t var byte
    q var byte
    sure var byte
    yedek var byte
    '*****************************************************************************
    myArray VAR BYTE[11]
    myArray[0]="H"     
    myArray[1]="E"
    myArray[2]="L"
    myArray[3]="L"
    myArray[4]="O"
    myArray[5]=" "
    myArray[6]="W"
    myArray[7]="O"
    myArray[8]="R"
    myArray[9]="L"
    myArray[10]="D"
    
    
    CLEAR  :  portd=255:sure=200 :GOTO oku:
    oku:
    z=11
    
    
        for i=1 to z
            
            harf_reg = myArray[i]
        
            call data_sec
            
            for y=0 to yinele
                call datalar
                sutun_reg[t]=veri  :  t=t+1
                adres_sec=adres_sec+1
            next y
        next i
    t=0
    goto gonder
    gonder:
    FOR Q=0 TO 5
        for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            
            portc=1111110:PAUSEUS sure:portc=111111
            
        next i
    
    
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portc=111101:pauseus sure:portc=111111
        next i
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portc=111011:pauseus sure:portc=111111
        next i
     
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portc=110111:pauseus sure:portc=111111
        next i
     
     for i=0 to 11
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portc=101111:pauseus sure:portc=111111
        next i
     
     
       
       
    t=0   
    
    
    NEXT Q
    goto kaydir
    kaydir:
        yedek=sutun_reg[0]
        for i=0 to 239
          ' sutun_reg[i]=sutun_reg[i+1]  ' this is for moving characters
        next i
          '  sutun_reg[240]=yedek
    goto gonder
    
    
    data_sec:
    select case harf_reg
    case "A"
    adres_sec=0  :  yinele=5  :  return
    case "B"
    adres_sec=6  :  yinele=5  :  return
    case "C"
    adres_sec=12  :  yinele=5  :  return
    case "D"
    adres_sec=18  :  yinele=5  :  return
    case "E"
    adres_sec=24  :  yinele=5  :  return
    case "F"
    adres_sec=30  :  yinele=5  :  return
    case "G"
    adres_sec=36  :  yinele=5  :  return
    case "H"
    adres_sec=42  :  yinele=5  :  return
    case "I"
    adres_sec=48  :  yinele=3  :  return
    case "i"
    adres_sec=52  :  yinele=3  :  return
    case "J"
    adres_sec=56  :  yinele=5  :  return
    case "K"
    adres_sec=62  :  yinele=5  :  return
    case "L"
    adres_sec=68  :  yinele=5  :  return
    case "M"
    adres_sec=74  :  yinele=5  :  return
    case "N"
    adres_sec=80  :  yinele=5  :  return
    case "O"
    adres_sec=86  :  yinele=5  :  return
    case "P"
    adres_sec=92  :  yinele=5  :  return
    case "Q"
    adres_sec=98  :  yinele=5  :  return
    case "R"
    adres_sec=104  :  yinele=5  :  return
    case "S"
    adres_sec=110  :  yinele=5  :  return
    case "T"
    adres_sec=116  :  yinele=5  :  return
    case "U"
    adres_sec=122  :  yinele=5  :  return
    case ""
    adres_sec=128  :  yinele=5  :  return
    case "V"
    adres_sec=134  :  yinele=5  :  return
    case "W"
    adres_sec=140  :  yinele=5  :  return
    case "X"
    adres_sec=146  :  yinele=5  :  return
    case "Y"
    adres_sec=152  :  yinele=5  :  return
    case "Z"
    adres_sec=158  :  yinele=5  :  return
    case " "
    adres_sec=164  :  yinele=5  :  return
    case "0"
    adres_sec=170  :  yinele=5  :  return
    case "1"
    adres_sec=176  :  yinele=3  :  return
    case "2"
    adres_sec=180  :  yinele=5  :  return
    case "3"
    adres_sec=186  :  yinele=5  :  return
    case "4"
    adres_sec=192  :  yinele=5  :  return
    case "5"
    adres_sec=198  :  yinele=5  :  return
    case "6"
    adres_sec=204  :  yinele=5  :  return
    case "7"
    adres_sec=210  :  yinele=5  :  return
    case "8"
    adres_sec=216  :  yinele=5  :  return
    case "9"
    adres_sec=222  :  yinele=5  :  return
    end select
    
    
    datalar:
    
    
     lookup adres_sec,[$7C,$0A,$09,$0A,$7C,0_      ;A
                       ,$7F,$49,$49,$49,$36,0_      ;B
                       ,$3E,$41,$41,$41,$22,0_      ;C
                       ,$7F,$41,$41,$41,$3E,0_      ;D
                       ,$7F,$49,$49,$49,$41,0_      ;E
                       ,$7F,$09,$09,$09,$01,0_      ;F
                       ,$3E,$41,$49,$49,$3A,0_      ;G
                       ,$7F,$08,$08,$08,$7F,0_      ;H
                       ,$41,$7F,$41,0_              ;I
                       ,$44,$7D,$44,0_              ;
                       ,$20,$40,$41,$3F,$01,0_      ;J
                       ,$7F,$08,$14,$22,$41,0_      ;K
                       ,$7F,$40,$40,$40,$40,0_      ;L
                       ,$7F,$02,$04,$02,$7F,0_      ;M
                       ,$7F,$04,$08,$10,$7F,0_      ;N
                       ,$3E,$41,$41,$41,$3E,0_      ;O
                       ,$7F,$09,$09,$09,$06,0_      ;P
                       ,$3E,$41,$51,$61,$3E,0_      ;Q
                       ,$7F,$09,$19,$29,$46,0_      ;R
                       ,$26,$49,$49,$49,$32,0_      ;S
                       ,$01,$01,$7F,$01,$01,0_      ;T
                       ,$3F,$40,$40,$40,$3F,0_      ;U
                       ,$1E,$41,$01,$41,$1E,0_      ;
                       ,$1F,$20,$40,$20,$1F,0_      ;V
                       ,$3F,$40,$30,$40,$3F,0_      ;W
                       ,$63,$14,$08,$14,$63,0_      ;X
                       ,$07,$08,$70,$08,$07,0_      ;Y
                       ,$61,$51,$49,$45,$43,0_      ;Z
                       ,$00,$00,$00,$00,$00,0_      ;Space
                       ,$3E,$51,$49,$45,$3E,0_      ;0
                       ,$42,$7F,$40,0_              ;1
                       ,$62,$51,$49,$45,$42,0_      ;2    
                       ,$22,$49,$49,$49,$36,0_      ;3
                       ,$18,$14,$12,$7F,$10,0_      ;4
                       ,$2F,$49,$49,$49,$31,0_      ;5
                       ,$3E,$49,$49,$49,$32,0_      ;6
                       ,$61,$11,$09,$05,$03,0_      ;7
                       ,$36,$49,$49,$49,$36,0_      ;8
                       ,$26,$49,$49,$49,$3E,0],veri ;9
    return
    I think my trouble is this part..
    Code:
     for i=1 to z
            
            harf_reg = myArray[i]
    
            call data_sec
    it produce this output (not HELLO WORLD)
    Name:  LedMatrix1.png
Views: 735
Size:  50.7 KB
    But when I modify it to this code..
    Code:
     for i=1 to z
            
            harf_reg = 64+i
    
            call data_sec
    This is the output..
    Name:  LedMatrix2.png
Views: 611
Size:  8.0 KB

    What do you think I'm missing in the process?

    Thanks,
    tacbanon
    Last edited by tacbanon; - 10th June 2012 at 15:02.

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,316

    Default Re: String of characters(array) to decimal value

    Hi,
    Try using GOSUB instead of CALL.
    Also, your FOR loop starts indexing at myArray[1] instead of myArray[0] but that's not the real problem.

    /Henrik.

  7. #7
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    Try using GOSUB instead of CALL.
    Also, your FOR loop starts indexing at myArray[1] instead of myArray[0] but that's not the real problem.
    /Henrik.
    Hi, I tried it already but no changes...probably I need to try it on the real hardware....I will post later any results.

    Kind regards,
    tacbanon

  8. #8
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    I thought it was a simulation issue so I tried it in the real device...but to my surprise I still get the same output..(not displaying 'HELLO WORLD')
    Attachment 6520

    I appreciate any input...

    Thanks in advance,
    tacbanon
    Attached Images Attached Images  
    Last edited by tacbanon; - 11th June 2012 at 02:02.

  9. #9
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,817

    Default Re: String of characters(array) to decimal value

    Looks to me as if you load HELLO WORLD into your array and then the following statement "CLEAR" erases all of your good work. I would try moving clear up above the array loading statements.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  10. #10
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Quote Originally Posted by Archangel View Post
    Looks to me as if you load HELLO WORLD into your array and then the following statement "CLEAR" erases all of your good work. I would try moving clear up above the array loading statements.
    Wow ..thank you for taking the time looking at the code...now it's working as expected..(yipee!).
    Thank you Archangel and thanks Henrik....

    Kind Regards,
    tacbanon

  11. #11
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Hi, I,m trying to modify the program by entering strings from serial communicator to make led matrix message display dynamic.
    I've been trying to incorporate DT's LCDBackpack code to this led matrix application but I'm getting no results.
    Here is what I'm doing...first is to test if interrupts will work.
    1. In the main loop I'm sending text/data thru serial communicator
    2. I'm using the LCDBackPack code to receive strings using "^" as the end text terminator.
    3. When the terminator is detected it calls the sub process which is the ledmatrix code(post#5).
    But I realized that it only happens once, and it never goes back to the main program to accept another set of text string...probably this is not a good solution to what I'm trying to achieve. I'm asking from the experienced members to give some pointers/suggestions that will solve the issue I'm having.
    I appreciate any input and your time.

    Regards,
    tacbanon

  12. #12
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,817

    Default Re: String of characters(array) to decimal value

    Please show us the mainloop which is only working once, or better yet all the code exactly as you have it.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  13. #13
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Hi, thanks for replying...please see the attached actual code I'm testing below.
    For now my goal is to test if interrupts will work every time there is data in the communication line.
    Code:
    ' This program is the PIC18F4550 LCDBACK pack version
    ' With Serial LCD connectd at PortC.0
    Include "modedefs.bas"
    asm    
        __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
        ;__CONFIG    _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
        __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
        __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L  & _BORV_2_2L  & _VREGEN_ON_2L   
        __CONFIG    _CONFIG2H, _WDT_OFF_2H 
        __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H 
        __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L  & _XINST_OFF_4L & _DEBUG_OFF_4L 
        endasm
    DEFINE    OSC 48
    ADCON1 = 15               ' Set all I/Os to Digital      
    'CMCON = 7                 ' Disable Comparators
    
    
    '********************************************************************************
    TRISA = 000000
    TRISE = 000000
    TRISD = 000000
    PORTD = 000000
    TRISB = 000000    ' Set Keypad I/O 
    TRISC = 000000    ' Set Keypad I/O 
    PORTC = 0   
    PORTB = 0             ' Set columns LOW  
    PortA = 0
    PORTD = 0   
    PORTE = 0   
    'porta=0  :  portb=0  :  portc=0  :  portd=0
    'trisa=0  :  trisb=0  :  trisc=0  :  trisd=0
    'porte=0  : trise=0
    
    
    harf_reg var byte
    adres_sec var byte
    yinele var byte
    sutun_reg var byte[300]
    veri var byte
    yazi_reg var byte 
    i VAR BYTE
    x var byte
    z var byte
    y var byte
    t var byte
    q var byte
    sure var byte
    yedek var byte
    myArray VAR BYTE[11]
    
    
    '********************************************************************************
    DEFINE HSER_RCSTA 90h        ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h        ' Enable transmit, BRGH = 0
    'DEFINE HSER_SPBRG 129         ' FOR 20MHZ 129 = 2400, 32=9600,25 @ 4 for 2400
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1        ' Clear overflow automatically
    
    
    RCIF VAR PIR1.5      ' Receive  interrupt flag (1=full , 0=empty)
    TXIF VAR PIR1.4      ' Transmit interrupt flag (1=empty, 0=full)
    LED VAR PORTA.4
    cntr var byte
    '*******************************************************************************
    OERR    VAR    RCSTA.1             ' Alias OERR (USART Overrun Error Flag)
    CREN    VAR    RCSTA.4             ' Alias CREN (USART Continuous Receive Enable)
    buffer_size    CON    64             ' Sets the size of the ring buffer, set up from 32
    buffer    VAR    BYTE[buffer_size]' Array variable for holding received characters
    index_in    VAR    BYTE          ' Pointer - next empty location in buffer
    index_out    VAR    BYTE         ' Pointer - location of oldest character in buffer
    bufchar    VAR    BYTE             ' Stores the character retrieved from the buffer
    'i        VAR    BYTE             ' loop counter 
    Col        VAR    BYTE             ' Stores location on LCD for text wrapping
    errflag    VAR    BYTE             ' Holds error flags
    index_in = 0
    index_out = 0
    i = 0
    col = 1
    cntr = 0
                                    'RxData var byte        
            CMCON = 7               ' PORTA is digital
            Pause 100               ' Wait for LCD to startup
            'high PortA.2            ' power for backlight
            'low  PortA.3            ' backlight ground
    INTCON = 000000                ' Enable interrupts
    ON INTERRUPT GoTo serialin        ' Declare interrupt handler routine
    PIE1.5 = 1                        ' Enable interrupt on USART
    pause 1000
    
    
    loop1:
            High PortC.1
            For i = 0 to 10     ' Delay for .02 seconds (10*2mS)
                Pause 2           ' Use a short pause within a loop
            Next i                ' instead of one long pause
            Low PortC.1
            For i = 0 to 10     ' Delay for .02 seconds (10*2mS)
                Pause 2           ' Use a short pause within a loop
            Next i                ' instead of one long pause
           
    display:                          ' dump the buffer to the LCD
           
            IF errflag Then error    ' Handle error if needed
            IF index_in = index_out Then loop1    ' loop if nothing in buffer
    
    
            GoSub getbuf            ' Get a character from buffer    
            
            HSEROUT [bufchar]       ' out to serial port
            '**************************************'
            '*************Inserted code here!********'
            '**************************************'                                                                                                                        
                                                                                                                       
            select case bufchar  
            case "^" 
            Serout PortC.0,T9600,[$1B,$45]
            Serout PortC.0,T9600,["LCDBack Pack"]
            '*****goto sub process
            HSEROUT ["Done here! "]
            HSEROUT ["Clear Variables",13]        
            pause 250
            index_in = 0
            index_out = 0
            i = 0
            col = 1
            gosub datadisplay
           
            
            case "$"
            HSEROUT ["Other func",13]   '' Extra functionalities
            case else 
            HSEROUT [buffer[index_in]," - ", Dec index_out,13]
            END select 
           '***************************************' 
            
            IF col > 20 Then        ' Check for end of line
                col = 1                ' Reset LCD location
                
                'LCDOut $fe,$c0,REP " "\20    ' Clear line-2 of LCD 
                
                'LCDOut $FE,2        ' Tell LCD to return home
                
                
            EndIF
    
    
    GoTo display            ' Check for more characters in buffer
    
    
    
    
    
    
                            ' Subroutines
    
    
    Disable                    ' Don't check for interrupts in this section
    
    
    getbuf:                    ' move the next character in buffer to bufchar
        
        index_out = (index_out + 1)            ' Increment index_out pointer (0 to 63)
                                            ' Reset pointer if outside of buffer
        IF index_out > (buffer_size-1) Then index_out = 0    
        bufchar = buffer[index_out]            ' Read buffer location
        
        
        
    Return
    
    
    
    
    error:                              ' Display error message if buffer has overrun
        IF errflag.1 Then              ' Determine the error
            'LCDOut $FE,$c0,"Clearing Display    Buffer"    ' Display buffer error on
                                                        ' line-2 and 3 Buff overrun
        Else
           'LCDOut $FE,$D4,"USART Overrun"    ' Display usart error on line-4
        EndIF
        
        LCDOut $fe,2                    ' Send the LCD cursor back to line-1 home
        For i = 2 to col                ' Loop for each column beyond 1
            'LCDOut $fe,$14                ' Move the cursor right to the right column
        Next i                          ' $14 = 20 DEC.
        
        errflag = 0            ' Reset the error flag
        CREN = 0            ' Disable continuous receive to clear overrun flag
        CREN = 1            ' Enable continuous receive
    
    
        GoTo display        ' Errors cleared, time to work.
        
        
    ' * * * * * * * * * * * * * * *  Interrupt handler
       
       
    '*******************************************************************************
    serialin:                        ' Buffer the character received
    
    
        IF OERR Then usart_error    ' Check for USART errors
        index_in = (index_in + 1)    ' Increment index_in pointer (0 to 63)
        IF index_in > (buffer_size-1) Then index_in = 0    'Reset pointer if outside of buffer
        IF index_in = index_out Then buffer_error    ' Check for buffer overrun
        HSerin [buffer[index_in]]    ' Read USART and store character to next empty location
        IF RCIF Then serialin        ' Check for another character while we're here
        
    Resume                            ' Return to program
    
    
    buffer_error:
        errflag.1 = 1        ' Set the error flag for software
    ' Move pointer back to avoid corrupting the buffer. MIN insures that it ends up within the buffer.    
        index_in = (index_in - 1) MIN (buffer_size - 1)    
        HSerin [buffer[index_in]]    ' Overwrite the last character stored (resets the interrupt flag)
        
    usart_error:
        errflag.0 = 1        ' Set the error flag for hardware
        
    Resume                    ' Return to program
    
    
    
    
    
    
    datadisplay:  ' this is the sub process
    
    
    portd=255:sure=200
    Serout PortC.0,T9600,[$D] ' second line of LCD
    Serout PortC.0,T9600,["Cnt: ",#index_out]
    myArray[0]="H"      
    myArray[1]="E"
    myArray[2]="L"
    myArray[3]="L"
    myArray[4]="O"
    myArray[5]=" "
    myArray[6]="W"
    myArray[7]="O"
    myArray[8]="R"
    myArray[9]="L"
    myArray[10]="D"
    
    
    GOTO oku:
    
    
    oku:
    
    
    z=10
    
    
    
    
    
    
        for i=0 to z
            
            harf_reg = myArray[i]
            
            GOSUB data_sec
            
            for y=0 to yinele
               GOSUB datalar
                sutun_reg[t]=veri  :  t=t+1
                adres_sec=adres_sec+1
            next y
        next i
    t=0
    goto gonder
    gonder:
    
    
    FOR Q=0 TO 5
        for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            
            portd=1111110:PAUSEUS sure:portd=111111
            
        next i
    
    
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portd=111101:pauseus sure:portd=111111
        next i
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portd=111011:pauseus sure:portd=111111
        next i
     
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portd=110111:pauseus sure:portd=111111
        next i
     
     for i=0 to 11
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portd=101111:pauseus sure:portd=111111
        next i
     
     
       
       
    t=0   
    
    
    NEXT Q
    goto kaydir
    kaydir:
    
    
    
    
        yedek=sutun_reg[0]
        for i=0 to 239
          sutun_reg[i]=sutun_reg[i+1]  ' this is for moving characters
        next i
          sutun_reg[240]=yedek
    GoTo display
    HSEROUT ["Gonder! ",13]
    goto gonder
    
    
    
    
    data_sec:
    select case harf_reg
    case "A"
    adres_sec=0  :  yinele=5  :  return
    case "B"
    adres_sec=6  :  yinele=5  :  return
    case "C"
    adres_sec=12  :  yinele=5  :  return
    case "D"
    adres_sec=18  :  yinele=5  :  return
    case "E"
    adres_sec=24  :  yinele=5  :  return
    case "F"
    adres_sec=30  :  yinele=5  :  return
    case "G"
    adres_sec=36  :  yinele=5  :  return
    case "H"
    adres_sec=42  :  yinele=5  :  return
    case "I"
    adres_sec=48  :  yinele=3  :  return
    case "i"
    adres_sec=52  :  yinele=3  :  return
    case "J"
    adres_sec=56  :  yinele=5  :  return
    case "K"
    adres_sec=62  :  yinele=5  :  return
    case "L"
    adres_sec=68  :  yinele=5  :  return
    case "M"
    adres_sec=74  :  yinele=5  :  return
    case "N"
    adres_sec=80  :  yinele=5  :  return
    case "O"
    adres_sec=86  :  yinele=5  :  return
    case "P"
    adres_sec=92  :  yinele=5  :  return
    case "Q"
    adres_sec=98  :  yinele=5  :  return
    case "R"
    adres_sec=104  :  yinele=5  :  return
    case "S"
    adres_sec=110  :  yinele=5  :  return
    case "T"
    adres_sec=116  :  yinele=5  :  return
    case "U"
    adres_sec=122  :  yinele=5  :  return
    case ""
    adres_sec=128  :  yinele=5  :  return
    case "V"
    adres_sec=134  :  yinele=5  :  return
    case "W"
    adres_sec=140  :  yinele=5  :  return
    case "X"
    adres_sec=146  :  yinele=5  :  return
    case "Y"
    adres_sec=152  :  yinele=5  :  return
    case "Z"
    adres_sec=158  :  yinele=5  :  return
    case " "
    adres_sec=164  :  yinele=5  :  return
    case "0"
    adres_sec=170  :  yinele=5  :  return
    case "1"
    adres_sec=176  :  yinele=3  :  return
    case "2"
    adres_sec=180  :  yinele=5  :  return
    case "3"
    adres_sec=186  :  yinele=5  :  return
    case "4"
    adres_sec=192  :  yinele=5  :  return
    case "5"
    adres_sec=198  :  yinele=5  :  return
    case "6"
    adres_sec=204  :  yinele=5  :  return
    case "7"
    adres_sec=210  :  yinele=5  :  return
    case "8"
    adres_sec=216  :  yinele=5  :  return
    case "9"
    adres_sec=222  :  yinele=5  :  return
    end select
    
    
    datalar:
    
    
     lookup adres_sec,[$7C,$0A,$09,$0A,$7C,0_ ;A
                       ,$7F,$49,$49,$49,$36,0_      ;B
                       ,$3E,$41,$41,$41,$22,0_      ;C
                       ,$7F,$41,$41,$41,$3E,0_      ;D
                       ,$7F,$49,$49,$49,$41,0_      ;E
                       ,$7F,$09,$09,$09,$01,0_      ;F
                       ,$3E,$41,$49,$49,$3A,0_      ;G
                       ,$7F,$08,$08,$08,$7F,0_      ;H
                       ,$41,$7F,$41,0_              ;I
                       ,$44,$7D,$44,0_              ;
                       ,$20,$40,$41,$3F,$01,0_      ;J
                       ,$7F,$08,$14,$22,$41,0_      ;K
                       ,$7F,$40,$40,$40,$40,0_      ;L
                       ,$7F,$02,$04,$02,$7F,0_      ;M
                       ,$7F,$04,$08,$10,$7F,0_      ;N
                       ,$3E,$41,$41,$41,$3E,0_      ;O
                       ,$7F,$09,$09,$09,$06,0_      ;P
                       ,$3E,$41,$51,$61,$3E,0_      ;Q
                       ,$7F,$09,$19,$29,$46,0_      ;R
                       ,$26,$49,$49,$49,$32,0_      ;S
                       ,$01,$01,$7F,$01,$01,0_      ;T
                       ,$3F,$40,$40,$40,$3F,0_      ;U
                       ,$1E,$41,$01,$41,$1E,0_      ;
                       ,$1F,$20,$40,$20,$1F,0_      ;V
                       ,$3F,$40,$30,$40,$3F,0_      ;W
                       ,$63,$14,$08,$14,$63,0_      ;X
                       ,$07,$08,$70,$08,$07,0_      ;Y
                       ,$61,$51,$49,$45,$43,0_      ;Z
                       ,$00,$00,$00,$00,$00,0_      ;Space
                       ,$3E,$51,$49,$45,$3E,0_      ;0
                       ,$42,$7F,$40,0_              ;1
                       ,$62,$51,$49,$45,$42,0_      ;2    
                       ,$22,$49,$49,$49,$36,0_      ;3
                       ,$18,$14,$12,$7F,$10,0_      ;4
                       ,$2F,$49,$49,$49,$31,0_      ;5
                       ,$3E,$49,$49,$49,$32,0_      ;6
                       ,$61,$11,$09,$05,$03,0_      ;7
                       ,$36,$49,$49,$49,$36,0_      ;8
                       ,$26,$49,$49,$49,$3E,0],veri ;9
    return
    
    
    '*****************************************************************************Main
    return
    Thanks in advance,
    tacbanon
    Last edited by tacbanon; - 15th June 2012 at 02:33.

  14. #14
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,817

    Default Re: String of characters(array) to decimal value

    Quote Originally Posted by tacbanon View Post
    Hi, thanks for replying...please see the attached actual code I'm testing below.
    For now my goal is to test if interrupts will work every time there is data in the communication line.

    Thanks in advance,
    tacbanon
    I would bet they don't givin' your use of ON INTERRUPT. Why did you elect not to use Darrel's instant Interrupts? On Interrupt will cause lost characters (I am betting) if it works at all. Assembly interrupts handle the event immediatly, on interrupt has to finish what it's doing before servicing the interrupt.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  15. #15
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Hi, I guess I need to start reading DT's interrupt and study some examples before going back to this issue I'm having with my setup...and post here the results.

    Kind regards,
    tacbanon

  16. #16
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Hi, I have a working code(serial communication w/ DT's interrupt) from Mr_e. But I noticed when Sending 3-5 bytes it works great but when beyond 5-10 or more characters it seems corrupted. Displays 4 or 5 characters most of the time and only once.
    I need to send at least 20-30 characters...can anyone explain/suggest a better approach?
    I'm using Pic18F4550 @ 20Mhz(external)
    Code:
     '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                         'Hserin with Darryl Taylor's Instant Interrupts
     '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    asm
        __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
        __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
        __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L  & _BORV_2_2L  & _VREGEN_ON_2L   
        __CONFIG    _CONFIG2H, _WDT_OFF_2H 
        __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H 
        __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L  & _XINST_OFF_4L & _DEBUG_OFF_4L 
    endasm
    
    
            
            
            DEFINE OSC 48       
            DEFINE HSER_RCSTA 90h ' enable serial port, 
            DEFINE HSER_TXSTA 20h  ' enable transmit,                  
            DEFINE HSER_BAUD 9600
            DEFINE HSER_CLOERR  1 ' automatic clear overrun error  
            
            TRISC  = 000000    ' PORTC.7 is the RX input, PORTC.6 is the TX output
                                  
        
        '   Serial communication definition
        '   ===============================
            '
      ADCON1 = 001111      'Set up ADCON1 register no matter what you're doing!!!!!!
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    
    
    INCLUDE "MODEDEFS.BAS"       ' Include Shiftin/out modes
    INCLUDE "DT_INTS-18.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"  ' Include if using PBP interrupts
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        '   Variable definition
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    PortB = 000000
    TRISB = 000000        
    RCIF       VAR     PIR1.5     ' Receive  interrupt flag (1=full , 0=empty)
    TXIF       VAR     PIR1.4     ' Transmit interrupt flag (1=empty, 0=full)
    led        var     PORTC.0
    led1        var     PORTC.1
    holdoff    var     word
    SerialData var     byte
    SerialInput var    byte[50]
    PortB = 0
    c var byte
    i var byte
    c = 0
    clear
    
    
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   RX_INT,    _Getbytes,    PBP,  no
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    
    @   INT_ENABLE  RX_INT     ; enable RX_INT interrupts
    
    
    
    
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
                       ' Subroutine to slow loop down some and toggle heartbeat
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
    Mainloop:
     c = 1
            for holdoff = 1 to 100
            pause 1
            next holdoff
            toggle led           'toggle led every loop for heartbeat  
            goto Mainloop
    
    
    
    
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
               'ISR for RX_int interrupt 
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
    
    
    Getbytes:
           
           While RCIF = 1     ' clear the buffer
           c = c+1
           HSERIN [Serialdata] ' take it
           HSEROUT [Serialdata,#c,13] ' take it out   
           Wend
          
           toggle led       'led to confirm program went to RX ISR
    
    
    @ INT_RETURN
    
    
    
    
    error:
          Toggle led1
    @ INT_RETURN
     end
    Thanks in advance,
    tacbanon

  17. #17
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,316

    Default Re: String of characters(array) to decimal value

    Hi,
    I think the problem is that you're trying to send three bytes while inside the ISR. Sending these three bytes holds up the CPU long enough for the RX-buffer of the USART to overflow. As a test try echoing Serialdata alone, I think it'll work then.

    /Henrik.

  18. #18
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    @Henrik
    I got it now thanks....but I bumped into another wall how can I clear the content of an array? In my set up I can not use CLEAR command.

    Regards,
    tacbanon

  19. #19
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,316

    Default Re: String of characters(array) to decimal value

    Code:
    ArrayLength CON 25
    
    myArray VAR BYTE[ArrayLength]
    i VAR BYTE
    
    For i = 0 to (ArrayLength - 1)
      myArray[i] = 0
    NEXT
    /H.

  20. #20
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Hi, just to remind everyone that the following code is a running LED matrix display.. I can now add text coming from the serial communicator. But I'm still having trouble clearing the array...initially it displays "HELLO WORLD" and when I type and send it via serial communicator using '^' as the end terminator it only adds to the initial string.
    Kindly check if there is anything obvious causing trouble to what I'm doing.
    Code:
    '****************************************************************
    '*  Name    : HSERIN-LedMatrix-4550 @ 20Mhz                     *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 6/15/2012                                         *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
     '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                         'Hserin with Darryl Taylor's Instant Interrupts
     '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    
    
    
    asm
        __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
        __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
        __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L  & _BORV_2_2L  & _VREGEN_ON_2L   
        __CONFIG    _CONFIG2H, _WDT_OFF_2H 
        __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H 
        __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L  & _XINST_OFF_4L & _DEBUG_OFF_4L 
    endasm
    
            
            
            DEFINE OSC 48       
            DEFINE HSER_RCSTA 90h ' enable serial port, 
            DEFINE HSER_TXSTA 20h  ' enable transmit,                  
            DEFINE HSER_BAUD 9600
            DEFINE HSER_CLOERR  1 ' automatic clear overrun error  
            
            TRISC  = %10000000    ' PORTC.7 is the RX input, PORTC.6 is the TX output
                                  
        
        '   Serial communication definition
        '   ===============================
            '
    ADCON1 = %00001111      'Set up ADCON1 register no matter what you're doing!!!!!!
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    
    INCLUDE "MODEDEFS.BAS"       ' Include Shiftin/out modes
    INCLUDE "DT_INTS-18.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"  ' Include if using PBP interrupts
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        '   Variable definition
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    c var byte
    c = 0
    clear
    
    g var byte
    g=0
    
    flag1 var byte
    flag1 = 0
    myArray VAR BYTE[300]
    Reset:
    
    ;((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((9 
                select case flag1
                case 1
                clear
                HSEROUT ["Flag1=1 ",13]
                               
                                myArray[0]="P"   ' When you do this the string is stored in RAM    
                                myArray[1]="I"
                                myArray[2]="C"
                                myArray[3]="B"
                                myArray[4]="A"
                                myArray[5]="S"
                                myArray[6]="I"
                                myArray[7]="C"
                                myArray[8]="2"
                                myArray[9]="."
                                myArray[10]="6" 
                                flag1 = 1
                                
                                
                case 2
                clear
                HSEROUT ["Flag1=2 ",13]
                               
                                myArray[0]="M"   ' When you do this the string is stored in RAM    
                                myArray[1]="I"
                                myArray[2]="C"
                                myArray[3]="R"
                                myArray[4]="C"
                                myArray[5]="H"
                                myArray[6]="I"
                                myArray[7]="P"
                                myArray[8]=" "
                                myArray[9]="C"
                                myArray[10]="P"
                                flag1 = 2
                                
                 case 0
                 clear
                 HSEROUT ["Flag1=0 ",13]
                               
                                myArray[0]="H"   ' When you do this the string is stored in RAM    
                                myArray[1]="E"
                                myArray[2]="L"
                                myArray[3]="L"
                                myArray[4]="O"
                                myArray[5]=" "
                                myArray[6]="W"
                                myArray[7]="O"
                                myArray[8]="R"
                                myArray[9]="L"
                                myArray[10]="D"
                                flag1 = 0
                case 3
                
                HSEROUT ["Flag1=3 ",13]
                flag1=3                        
                g = 0                
                
                End select 
       
    ;((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( 
    
    
    ADCON1 = 15               ' Set all I/Os to Digital      
    CMCON = 7                 ' Disable Comparators
    
    TRISA = %00000000
    TRISE = %00000000
    TRISD = %00000000
    PORTD = %00000000
    TRISB = %00000000    ' Set Keypad I/O 
    TRISC = %10000000    ' Set Keypad I/O 
    PORTC = 0   
    PORTB = 0             ' Set columns LOW  
    PortA = 0
    PORTD = 0   
    PORTE = 0   
    HSEROUT ["Restart ",13]
    
    harf_reg var byte
    adres_sec var byte
    yinele var byte
    sutun_reg var byte[300]
    veri var byte
    yazi_reg var byte 
    i VAR BYTE
    x var byte
    z var byte
    y var byte
    t var byte
    q var byte
    sure var byte
    yedek var byte
    ;myArray VAR BYTE[11]
    '*****************************************************************************     
    RCIF       VAR     PIR1.5     ' Receive  interrupt flag (1=full , 0=empty)
    TXIF       VAR     PIR1.4     ' Transmit interrupt flag (1=empty, 0=full)
    led        var     PORTC.0
    led1        var     PORTC.1
    led5        var     PORTC.5
    holdoff    var     word
    SerialData var     byte
    SerialInput var    byte[50]
    portd=255:sure=200 
    
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   RX_INT,    _Getbytes,    PBP,  no
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE  RX_INT     ; enable RX_INT interrupts
    
    
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
                       ' Subroutine to slow loop down some and toggle heartbeat
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
    Mainloop:
    
            GOTO oku:
    
    oku:
    if flag1 < 3 then
    z=10
    else
    z = c
    ENdif
    
    
    
        for i=0 to z
        '**************************************************************************        
        '*************************************************************************  
           if flag1 < 3 then        
            harf_reg = myArray[i]
            else
            harf_reg = SerialInput[i]
            Endif
            
            GOSUB data_sec
            
            for y=0 to yinele
               GOSUB datalar
                sutun_reg[t]=veri  :  t=t+1
                adres_sec=adres_sec+1
            next y
        next i
    t=0
     
    goto gonder
    gonder:
    
    
    FOR Q=0 TO 5
        for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            
            portd=%111111110:PAUSEUS sure:portd=%11111111
            
        next i
    
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portd=%11111101:pauseus sure:portd=%11111111
        next i
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portd=%11111011:pauseus sure:portd=%11111111
        next i
     
     for i=0 to 15
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portd=%11110111:pauseus sure:portd=%11111111
        next i
     
     for i=0 to 11
            portb=sutun_reg[t]  :  t=t+1
            porta=i
            portd=%11101111:pauseus sure:portd=%11111111
        next i
      
    t=0   
    
    NEXT Q
    goto kaydir
            gosub datadisplay
              
            goto Mainloop
    
    
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
               'ISR for RX_int interrupt 
            '((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
    
    Getbytes:
            
           While RCIF = 1     ' clear the buffer
           c = c + 1
           HSERIN 100,error,[Serialdata] ' take it
          
           HSEROUT [Serialdata] ' take it out 
           select case Serialdata          ' What to do with that data???
                                    
               case "A"            ' User selection = 1
                    HSEROUT ["Change to A message",13] ' take it out 
                    flag1 = 1 
                    goto Reset
               case "B"
                    HSEROUT ["Change to B message",13] ' take it out 
                    flag1 = 2 
                    goto Reset
               case "C"
                    HSEROUT ["Change to C message",13] ' take it out 
                    flag1 = 0 
                    goto Reset
               case "^"
                    HSEROUT ["Change to Custom message",13] ' take it out  
                    flag1 = 3 
                    For i = 0 to (10)
                      myArray[i] = 0
                    NEXT
                    goto Reset  
                    
               case else 
                          
                   SerialInput[c] = Serialdata  
             End select    
            
            
                
           Wend
           toggle led       'led to confirm program went to RX ISR
           '*******************************************************************************
    
    
    @ INT_RETURN
    
    
    error:
          Toggle led1
    @ INT_RETURN
     end
     
     
     ;*****************************************************************************
    datadisplay: 
    
    
    
    kaydir:
    '''''''''''''''''''''''''''''''''''''''''''''''''''''
    'serout2 PortC.5,T9600,[254,129,myArray] 'myArray[i]
    ;serout PortC.5,T9600,[254,192,"MicroBox"]
    '''''''''''''''''''''''''''''''''''''''''''''''''''''
    
        yedek=sutun_reg[0]
        for i=0 to 239
          sutun_reg[i]=sutun_reg[i+1]  ' this is for moving characters
        next i
          sutun_reg[240]=yedek
    '  ----------goback to main
    goto gonder
    return
    
    data_sec:
    select case harf_reg
    case "A"
    adres_sec=0  :  yinele=5  :  return
    case "B"
    adres_sec=6  :  yinele=5  :  return
    case "C"
    adres_sec=12  :  yinele=5  :  return
    case "D"
    adres_sec=18  :  yinele=5  :  return
    case "E"
    adres_sec=24  :  yinele=5  :  return
    case "F"
    adres_sec=30  :  yinele=5  :  return
    case "G"
    adres_sec=36  :  yinele=5  :  return
    case "H"
    adres_sec=42  :  yinele=5  :  return
    case "I"
    adres_sec=48  :  yinele=3  :  return
    case "i"
    adres_sec=52  :  yinele=3  :  return
    case "J"
    adres_sec=56  :  yinele=5  :  return
    case "K"
    adres_sec=62  :  yinele=5  :  return
    case "L"
    adres_sec=68  :  yinele=5  :  return
    case "M"
    adres_sec=74  :  yinele=5  :  return
    case "N"
    adres_sec=80  :  yinele=5  :  return
    case "O"
    adres_sec=86  :  yinele=5  :  return
    case "P"
    adres_sec=92  :  yinele=5  :  return
    case "Q"
    adres_sec=98  :  yinele=5  :  return
    case "R"
    adres_sec=104  :  yinele=5  :  return
    case "S"
    adres_sec=110  :  yinele=5  :  return
    case "T"
    adres_sec=116  :  yinele=5  :  return
    case "U"
    adres_sec=122  :  yinele=5  :  return
    case ""
    adres_sec=128  :  yinele=5  :  return
    case "V"
    adres_sec=134  :  yinele=5  :  return
    case "W"
    adres_sec=140  :  yinele=5  :  return
    case "X"
    adres_sec=146  :  yinele=5  :  return
    case "Y"
    adres_sec=152  :  yinele=5  :  return
    case "Z"
    adres_sec=158  :  yinele=5  :  return
    case " "
    adres_sec=164  :  yinele=5  :  return
    case "0"
    adres_sec=170  :  yinele=5  :  return
    case "1"
    adres_sec=176  :  yinele=3  :  return
    case "2"
    adres_sec=180  :  yinele=5  :  return
    case "3"
    adres_sec=186  :  yinele=5  :  return
    case "4"
    adres_sec=192  :  yinele=5  :  return
    case "5"
    adres_sec=198  :  yinele=5  :  return
    case "6"
    adres_sec=204  :  yinele=5  :  return
    case "7"
    adres_sec=210  :  yinele=5  :  return
    case "8"
    adres_sec=216  :  yinele=5  :  return
    case "9"
    adres_sec=222  :  yinele=5  :  return
    end select
    
    datalar:
    
     lookup adres_sec,[$7C,$0A,$09,$0A,$7C,0_      ;A
                       ,$7F,$49,$49,$49,$36,0_      ;B
                       ,$3E,$41,$41,$41,$22,0_      ;C
                       ,$7F,$41,$41,$41,$3E,0_      ;D
                       ,$7F,$49,$49,$49,$41,0_      ;E
                       ,$7F,$09,$09,$09,$01,0_      ;F
                       ,$3E,$41,$49,$49,$3A,0_      ;G
                       ,$7F,$08,$08,$08,$7F,0_      ;H
                       ,$41,$7F,$41,0_              ;I
                       ,$44,$7D,$44,0_              ;
                       ,$20,$40,$41,$3F,$01,0_      ;J
                       ,$7F,$08,$14,$22,$41,0_      ;K
                       ,$7F,$40,$40,$40,$40,0_      ;L
                       ,$7F,$02,$04,$02,$7F,0_      ;M
                       ,$7F,$04,$08,$10,$7F,0_      ;N
                       ,$3E,$41,$41,$41,$3E,0_      ;O
                       ,$7F,$09,$09,$09,$06,0_      ;P
                       ,$3E,$41,$51,$61,$3E,0_      ;Q
                       ,$7F,$09,$19,$29,$46,0_      ;R
                       ,$26,$49,$49,$49,$32,0_      ;S
                       ,$01,$01,$7F,$01,$01,0_      ;T
                       ,$3F,$40,$40,$40,$3F,0_      ;U
                       ,$1E,$41,$01,$41,$1E,0_      ;
                       ,$1F,$20,$40,$20,$1F,0_      ;V
                       ,$3F,$40,$30,$40,$3F,0_      ;W
                       ,$63,$14,$08,$14,$63,0_      ;X
                       ,$07,$08,$70,$08,$07,0_      ;Y
                       ,$61,$51,$49,$45,$43,0_      ;Z
                       ,$00,$00,$00,$00,$00,0_      ;Space
                       ,$3E,$51,$49,$45,$3E,0_      ;0
                       ,$42,$7F,$40,0_              ;1
                       ,$62,$51,$49,$45,$42,0_      ;2    
                       ,$22,$49,$49,$49,$36,0_      ;3
                       ,$18,$14,$12,$7F,$10,0_      ;4
                       ,$2F,$49,$49,$49,$31,0_      ;5
                       ,$3E,$49,$49,$49,$32,0_      ;6
                       ,$61,$11,$09,$05,$03,0_      ;7
                       ,$36,$49,$49,$49,$36,0_      ;8
                       ,$26,$49,$49,$49,$3E,0],veri ;9
    return
    Kind regards,
    tacbanon
    Last edited by tacbanon; - 19th June 2012 at 16:41.

  21. #21
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Re: String of characters(array) to decimal value

    Hi, the way it worked for me is to reset it before sending a new string of character...
    @ RESET did the trick.
    Thanks everyone for helping me out.

    regards,
    tacbanon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts