Briefly, maximum number of vars?


Closed Thread
Results 1 to 31 of 31

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    These are my own vars.

    Code:
    	
    Change_delay var word[6]
    Delay_set   var word[6]
    
    Tube_previous   var byte[6]
    Tube_current    var byte[6]
    Tube_next   var byte[6]
    maxtubes    var byte
    Datim_buf   var byte[8]
    Scroll_delay    var byte
    TScroll_progress    var byte
    Raw_tube    var byte[6]; $200
    RX_BUFFER Var Byte[50] 
     
    Tube_sel  var byte 
    Tube      var byte
    Tube_max  var byte
    
    DP  var byte[6]
    
    Delay_cnt   var byte
    delay_cnt = 255
    
    Delay_mode_u  var bit
    
    
    BlanksL var byte
    BlanksH var byte
    SegsL   var byte
    SegsH   var byte
    
    Hours   VAR BYTE
    
    Minutes VAR BYTE
    
    Seconds VAR BYTE
    
    Year    VAR BYTE
    
    Month   VAR BYTE
    
    Day     VAR BYTE
    
    Weekday VAR BYTE
    
    Lastsecs    var byte
    
    sec_cntr    var byte: sec_cntr = 0
    
    Sword   var word ; spare word
    
    Addr    var word
    
    Prog_split  var byte
    
    Longest_effect  var byte
    
    Dir_bit var bit :dir_bit = 1 
    
    Out_bufL    var byte
    Out_bufH    var byte
    Eout_bufH   var byte[6]
    Eout_bufL   var byte[6]
    Speed_trim_set  var byte
    Speed_trim_val  var byte
    Saved_Digit   var byte[6]
    Saved_DP    var byte[6]
    Touch_Status var byte
    Touch_Val   var word
    Saved_effect    var byte[6]
    Cycle_cntr  var word :cycle_cntr = 0
    
    Letter_mode var byte :letter_mode = 0
    Letter_effect var byte :letter_effect = 0
    Letter_speed var byte :letter_speed = 0
    Letter_pause var byte :letter_pause = 0
    Letter_time_freq var byte :letter_time_freq = 0
    Letter_time_mode var byte :letter_time_mode = 0
    Letter_date_freq var byte :letter_date_freq = 0
    Letter_date_mode var byte :letter_date_mode = 0
    Letter_temp_freq var byte :letter_temp_freq = 0
    Letter_temp_mode var byte :letter_temp_mode = 0
    
    Letter_time_cntr var byte : letter_time_cntr = 0
    Letter_date_cntr var byte : letter_date_cntr = 0
    
    
    Seg_progress    var byte
    Disp_mode   var byte: disp_mode = 0
    ; mode 0 = serial data
    ; mode 1 = time
    ; mode 2 = date
    ; mode 3 = Letterplay
    
    ;EEDATA  var byte
    ;EEADR   var word
    
    obit var bit
    
    q   var byte
    X var byte
    X2 var byte 
      
    RX_BYTE_CNT Var Byte 
    RX_BUF Var BYTE      
    
    clk var PORTB.0
    dat var PORTB.1
    strobe  var PORTB.2
    blank   var PORTB.3
    
    
    Device VAR BYTE[6]  
    
    M_type  VAR byte
    M_type1 var byte     
    SPARE   VAR BYTE    
    FONT    VAR byte[6] 
    EFFECT  var byte[6] 
    control var Byte
    Dig_newL    var byte[6]
    Dig_newH    var byte[6]
    Dig_oldL    var byte[6]
    Dig_oldH    var  byte[6]
    Effect_pause var byte[6]
    Effect_var  var byte[6]
    Outa2h      var byte
    Outi2p      var byte
    
    ESPEED var byte[6]  
                        
    EE_ADR var word 
    EE_DAT var byte
    Effect_progress var byte[6]
    RX_PROGRESS var byte
    Tube_dat    var byte[6]
    Last_tube_dat   var byte
    
    
    int_dev var byte
    base_data   var word
    base_data = 1012
    tube_mask   var byte
    randnum var word 
    
    mode    var byte
    I can't post everything together because it exceeds the maximum message size, so you might want to add the SDFS vars to the above list yourself.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    This is my ISR

    Code:
       
    ASM
    myint
            btfss   PIR1,0 ; timer1 o/flow
            bra     Data?
    ; keypress stuff here       
                    
    EndKey:        
    ; end of keypress code        
            bcf     PIR1,0
            bra     end_int
            
    Data?        
            btfss   PIR1,5    ; is the received data flag set ?
            goto     dot
            movf    RCREG,w
            movwf   _RX_BUF  ; save the received byte immediately
            movwf   TXREG    ; Load the TX register immediately to pass the byte on
            nop
    x1:        
            btfss   PIR1,TXIF  ; Wait for TX send to complete
            bra     x1
    
    ; progrss register bits 0-3 get set as each element of the header
    ; is received. If a bad byte is detected then progress is reset
    ; and the code starts waiting for another $ sign
    
            
    prog0   btfsc   _RX_PROGRESS,0  ; has  the progress,0 step been completed
            bra     prog1        ; yes, test for progress,1
    
            movf    _RX_BUF,w
            xorlw   '$'          ; test if this byte is a $ sign
            btfss   STATUS,Z
            goto     dump         ; not a $ sign, clear the progress register
            bsf     _RX_PROGRESS,0  ; no, set this bit now
            movf    TMR1L,w
            subwf   _randnum,f
            goto    out          ; is a $ sign, don't clear progress, allow more
            
    prog1   btfsc   _RX_PROGRESS,1 ; same as above, validate the received data/header
            bra     prog2
    
            movf    _RX_BUF,w
            xorlw   'B'
            btfss   STATUS,Z
            goto    dump 
            bsf     _RX_PROGRESS,1  
            goto     out
            
    prog2   btfsc   _RX_PROGRESS,2
            bra     prog3
    
            movf    _RX_BUF,w
            xorlw   '7'
            btfss   STATUS,Z
            goto    dump  
            bsf     _RX_PROGRESS,2
            goto     out
            
    
            
    ; The fourth byte to be received is the 'type of message' character
    ; as for prog0 to prog2, if the fourth byte doesn't meet the test
    ; criteria of being a valid message type this data sentence is aborted 
           
    prog3   btfsc   _RX_PROGRESS,3
            bra     prog4
            clrf    _M_type 
            clrf    _M_type1
            
    
    
    
    typep?:  
            movf    _RX_BUF,w ; decimal points
            xorlw   'P'
            bnz     typem?
            bsf     _M_type,0
            bra     duntype
    
    typem?:                   ; message ascii digit
            movf    _RX_BUF,w
            xorlw   'M'
            bnz     typef?
            clrf    _Disp_mode
            bsf     _M_type,1
            bra     duntype
    typef?:                  ; font
            movf    _RX_BUF,w
            xorlw   'F'
            bnz     typew?
            BSF     _M_type,3
            bra     duntype
    typew?:                  ; UDC write command
            movf    _RX_BUF,w
            xorlw   'W'
            bnz     typee?
            bsf     _M_type,2
            bra     duntype
    typee?:                  ; effect
            movf    _RX_BUF,w
            xorlw   'E'
            bnz     types?
            bsf     _M_type,4
            bra     duntype
    types?:                  ; speed
            movf    _RX_BUF,w
            xorlw   'S'
            bnz     typed?
            bsf     _M_type,5
            bra     duntype
    typed?:                  ; digit delay
            movf    _RX_BUF,w
            xorlw   'D'
            bnz     typev?
            bsf     _M_type,7 
            bra     duntype
    typev?:
            movf    _RX_BUF,w
            xorlw   'V'
            bnz     typec?
            bsf     _M_type,6
            bra     duntype
    typec?:
            movf    _RX_BUF,w   ; clock function
            xorlw   'C'
            bnz     typea?
            bsf     _M_type1,0
            bra     duntype
    typea?:
            movf    _RX_BUF,w   ; alarm function
            xorlw   'A'
            bnz     typel?
            bsf     _M_type1,1
            bra     duntype
    typel?:
            movf    _RX_BUF,w   ; Letter play
            xorlw   'L'
            bnz     typez?
            bsf     _M_type1,2
            bra     duntype
    typez?:
            movf    _RX_BUF,w   ; set total number of digits in array
            xorlw   'Z'
            bnz     dump ;typenul?
            bsf     _M_type1,3
            bra     duntype        
    
            
    duntype: 
    
            bsf     _RX_PROGRESS,3
            clrf    _RX_BYTE_CNT 
            lfsr    1,_RX_BUFFER
            bra     out
            
      
    ;'; If we got to here then the message type is valid.
    ;'; now to pick the correct data byte from the stream relevant to this device's
    ;'; enumerated position in the chain, and then save it for processing
    prog4   ;duntype
    
            
    capture_bits:
            movff    _RX_BUF,POSTINC1   ; capture all bytes of data
            incf    _RX_BYTE_CNT,f
         
    inc_dun:
            btfss   _M_type,2        ; Is this a UDC write ?
            bra     typnot2 
            movf   _RX_BYTE_CNT,w
            xorlw   18
            bz      goodmes
            bra    out            
            
            ; For all other, non- type 2 messages, count data bytes
            ; and when the current byte number equals this device's
            ; enumerated position put the current data byte in the buffer
    typnot2 
            movf    _RX_BUF,w
            xorlw   13          ; Is this the final character of a message ?
            bz      goodmes
    
            btfsc   _M_type1,0 ; Clock command
            bra     out
            btfsc   _M_type1,3 ; Declare total number of tubes in array
            bra     out
            btfsc   _M_type1,1 ; Alarm command
            bra    out
            btfsc   _M_type1,2 ; FLW functions 'L' letter play
            bra    out
            btfsc   _M_type,7   ; Delay functions
            bra     out
            btfsc   _M_type,1   ; Message functions
            bra     out
            
    ld_tube_dat:
    
            movf    _RX_BYTE_CNT,w
            xorwf   _Device,w
            bnz      dev2
            movff   _RX_BUF,_Tube_dat   ; Tube_dat now has the correct data byte with respect
            bra     out       ; to this device's position in the chain
    
    dev2
    
            movf    _RX_BYTE_CNT,w
            xorwf   _Device+1,w
            bnz      dev3
            movff   _RX_BUF,_Tube_dat+1   ; Tube_dat+1 now has the correct data byte with respect
            bra     out       ; to this device's position in the chain
            
    dev3
    
            movf    _RX_BYTE_CNT,w
            xorwf   _Device+2,w
            bnz      dev4
            movff   _RX_BUF,_Tube_dat+2   ; Tube_dat+2 now has the correct data byte with respect
            bra     out       ; to this device's position in the chain
    
    dev4
    
            movf    _RX_BYTE_CNT,w
            xorwf   _Device+3,w
            bnz      out
            movff   _RX_BUF,_Tube_dat+3   ; Tube_dat+3 now has the correct data byte with respect
            bra     out       ; to this device's position in the chain
    
    goodmes 
            movf    TMR4,w
            subwf   _randnum,w
            movwf   TMR4   
           bsf  _control,7
         
    dump    
            clrf    _RX_PROGRESS
              
    dot:     
            btfss   INTCON,2  ;Did a timer0 overflow occur ?
            bra    out
            bcf    INTCON,2  ; do timer0 maintenance
            bsf    _control,1
            movlw  160
            movwf  TMR0L
          
            
            
    out:       
    
    end_int:
    
            RETFIE FAST  
    endasm

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Here's a video of the device, when it works. This is the LED version, my main work is on the VFD tube version, versions of which can be seen in my Youtube collection. The only difference between the VFD and LED versions is the order of bitbanging data to the output SR's, and the VFD version uses CCP1 to generate 40V via a boost convertor



    The VFD Version


    This is the version which started it all off.


    Note that in the last video (the first incarnation) each display tube has it's own controller IC, a PIC16F690, where the two previous versions now multiplex 4 display elements and have independent transition effects, operated by a 18426j50 driving an output shift register.

    The displays are daisychained via a serial connection and form a self arranging linear network. They take simple ascii text commands at the input and organise themselves so that the correct character is displayed on the correct tube. For example the message $B7MTest , would put the letter T on the first tube, e on the next, and so on.<$B7M> is the header used for display 'M'essages.

    if they are all connected together then each element has it's own 'place' in the display array (very much like the DMX protocol uses individual addresses too) then larger arrays of mixed display media can be built, such as this




    I keep most of the detail at my Yahoogroup
    http://groups.yahoo.com/group/smartsockets/
    http://groups.yahoo.com/group/smartsockets/
    Last edited by Chris Barron; - 24th March 2010 at 11:05.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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