scrolling letters as your Merry Christmas

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am

Re: scrolling letters as your Merry Christmas

Post by MrDEB » Mon Mar 17, 2014 8:52 am

here is what my progress looks like
http://i992.photobucket.com/albums/af44 ... 3b02b1.mp4

Image

The code without the CONST arrays

Code: Select all

DIM Scroll_Speed AS INTEGER
DIM x AS BYTE
DIM y AS BYTE
SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTD all outputs
TRISB = %00000000 

Scroll_Speed = 60
 y = 0
WHILE true
   
   FOR x = 0 TO 7
      portc = %00000000
      portc = A_data(x + y)         //CONST array data Portc C is Anodes
      portb = Cathodes_Data(x)      // Cathodes on PortB
      DELAYMS(1)
     portc = %00000000
     DELAYuS(100)
   NEXT 
   
     IF y +x <210  THEN    // number of byte data in CONST arrays
    DELAYMS(Scroll_Speed)
     y = y + 1             // next A_Data byte data
     
     ELSE 
     y = 0
     
     END IF
    
     
      WEND
   

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: scrolling letters as your Merry Christmas

Post by brad » Mon Mar 17, 2014 9:41 pm

It certainly is scrolling nicely for you, where to next?

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am

Re: scrolling letters as your Merry Christmas

Post by MrDEB » Tue Mar 18, 2014 7:41 am

Yes but I need to clean up the letters and make shorter spaces between letters.
My issue now is getting a board to work. I have a bad matrix that I should have tested before soldering.
Here is the code I used to test the remaining matrix's. Am working on another board soldering in the 805 resistors (boy are they small) and using some silver bearing soldering for the first time. I got to thinking about a new project of a 8 x 8 x 8 led cube that scrolls a sentence or ?. Probably been done but I have other projects that need to be completed such as the recumbent bikes(more of a trike w/ 3 wheels and a tandem w/ 4 wheels)I am designing and building.

Code: Select all

DEVICE = 18F2420

CLOCK = 8
INCLUDE "convert.bas"
INCLUDE "InternalOscillator.bas"
INCLUDE "Utils.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
DIM led(7) AS BYTE                      
// variable declaration                               
DIM x AS BYTE
DIM y AS BYTE
DIM index AS BYTE 

CONST Anodes_data(8)AS BYTE = (%00000001,%00000010,%00000100,%00001000,%00010000,%00100000,%01000000,%10000000)              

CONST Cathodes_Data(8) AS BYTE = (%11111110,%11111101,%11111011,%11110111,%11101111,%11011111,%10111111,%01111111)

// Start Of Program
SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTC all outputs
TRISB = %00000000                   // Make PORTB all outputs

// Main Loop
WHILE True()
 FOR x = 0 TO 7 
   FOR y = 0 TO 7
   portc=Anodes_data(y)
   portb=Cathodes_Data(x)
    
   DELAYMS(200)
   portc = %00000000
   DELAYMS(200)
   NEXT
 NEXT
WEND                              
 

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: scrolling letters as your Merry Christmas

Post by brad » Tue Mar 18, 2014 8:34 pm

how did you draw up the letters? Are they contained in one array?

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am

Re: scrolling letters as your Merry Christmas

Post by MrDEB » Sat Dec 03, 2016 11:50 pm

been hacking and still can't get any displan much less a code without errors. In the section Draw Data I get errors Data_Bus = Sentence_Data XOR %11111111 ' reverse the data bits
I need to get this working as I received my boards etc.

Code: Select all

{

}

{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/29/2016                                                     *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************


*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [SELECT VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2014 [SELECT VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 3/4/2014                                                       *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
DEVICE = 18F2420

CLOCK = 8
    

// import LCD library...

INCLUDE "convert.bas"
INCLUDE "InternalOscillator.bas"
INCLUDE "Utils.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'

INCLUDE "SUART.bas"
// Arrays                                                                                   
// Arrays 
                                                                                  
// Arrays
         
// Desired sentence  (ANODES)
CONST Sentence_Data(96) AS BYTE =    (%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111110,%01001010,%01001010,%01000010,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111110,%01000010,%01000010,%01000010,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00111100,%01000010,%01000010,%00111100,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111110,%01000010,%01000010,%01000010,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111110,%01000010,%01000010,%01000010,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000)


// CATHODES
CONST Row1Data(8) AS BYTE =    (%11111110,%11111101,%11111011,%11110111,%11101111,%11011111,%10111111,%01111111)

DIM Display_Out AS BYTE        ' CONST array data
DIM Display_Buffer(8) AS BYTE  ' data to send to matrix
DIM Data_Bus AS portb        ' data that matrix displays
DIM Colum_start AS WORD        ' cathodes
DIM Anode_Data AS PORTC        ' Anodes
DIM x AS BYTE
DIM y AS BYTE
DIM Speed AS BYTE

//SUB ROUTINES

 SUB Load_Buffer()
 
     FOR x = 0 TO 15               ' 120 / 8 = 15
        Display_Buffer(x) = Sentence_Data(x)
        NEXT
     END SUB
 
SUB Draw_Data()
    
    FOR x = Colum_start TO (Colum_start+7)   ' COLUMS ON PORT b counter
             Display_Out = Display_Buffer(x)                  '  const data
           Data_Bus = Display_Out XOR $11111111              ' inverts the CONST array data at the port
           Display_Buffer(x) = Sentence_Data(x)
           Data_Bus =  Sentence_Data XOR %11111111          ' reverse the data bits
           Data_Bus = 0                              ' data bus
           Data_Bus.bits(7 - (x- Colum_start)) = 1  ' cycle the anodes from 0 to 7
           Data_Bus = 0
           display_out = 1
          DELAYMS(10)
           display_out= 0
          
           NEXT
          
      END SUB
        
SUB Scroll_Text()
    IF Speed <> 0 THEN
    DEC(Speed)
    ELSE
        Speed = 6
        Colum_start = Colum_start + 1
        IF Colum_start + 8 = 96 THEN     ' # of elements in CONST array Colum Start is Cathodes on portb
           Colum_start = 0
           END IF
        END IF
    END SUB
    
   
    'END SUB
'SetTX(PORTC.6)
'SetRX(PORTC.7)
'SetBaudrate(sbr9600)
'SetMode(umTrue)         

SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTD all outputs
TRISB = %00000000                   // Make PORTB all outputs
y = 0
Speed = 50
Colum_start = 0
Load_Buffer()
WHILE true
    
    Draw_Data()
     FOR y = 0 TO 20
      Draw_Data()
      NEXT
    Scroll_Text()
WEND


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest