Christmas ornament project

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
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Christmas ornament project

Post by MrDEB » Tue Nov 15, 2016 2:48 am

I thought I posted this earlier today but ??
Am working on a Christmas tree ornament similar to Brads tree ornament project except I am using a bi colored matrix and utilizing all the pins. Using a 18F24K20 pic and Swordfish for programming. Have a pcboard designed using Diptrace. Included files in case anyone finds any issues.
Want to experiment changing the port used to control the red and green but randomize the port used. In simple terms, toggle ports for green or red so part of a letters pixels (Merry Christmas) are red or green.
Attachments
xmas ornment2.zip
(11.23 KiB) Downloaded 623 times
xmas pcb1.zip
(13.47 KiB) Downloaded 634 times

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by brad » Thu Nov 17, 2016 8:12 pm

Looking at your design, it seems you're not using any sort of transistors or perhaps a darlington array for the LED's. You will most certainly get uneven brightness with the LED's depending on how many LED's are turned on. This is the mistake I made with my early LED matrix designs.

Have you tested it out yet?

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Fri Nov 18, 2016 12:04 am

am assembling a test circuit daughter board that plugs into a Tap-28 board. I have since included resistors for the leds. hopefully by using PWM or in laymens terms, toggle the leds really fast??
After I get the testy board working will find out just how bad the dimness of the leds are. One note I am using an 18F24K20 pic.
These are going to be Christmas presents that are personalized with recipients names.
hoping I have no issues w/ led brightness levels.

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Christmas ornament project

Post by bitfogav » Sat Nov 19, 2016 8:45 pm

I think I'm with Brad here, and controlling the brightness of the leds might be an issue. When lighting up several leds on a row at the same time will seem more dimmer than only lighting up a single led on a row. But yes nice Diptrace design and I like the schematics.

Just a thought are you disabling the function of the MCLR pin? I don't see any external circuitry to stop the PIC resetting?.
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Sun Nov 20, 2016 2:04 pm

been busy getting the 18F24K20 code to compile and finally got it to decide to compile.
Now working on getting the matrix to display scrolling text but the LEDs seem pretty bright. NOTE not as bright with just a battery powering the matrix by itself (getting all the ports connected to the right matrix pins).
I have 100 ohm resistors on the common Anodes and dealing with the red and green leds.
At first run the green leds were coming on without any directive in the code.
I just put PORTA = %11111111

here is my code that needs LOTS of work to get it working and I mean LOTS of work. My plan is to give personalized Christmas ornaments as gifts.

Code: Select all

****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/19/2016                                                     *
*  Version : 1.0                                                            *
*  Notes   : Christmas matrix                                                               *
*          :                                                                *
*****************************************************************************
}
DEVICE = 18F24k20 ' Tell the compiler what chip we are using
CLOCK = 8 ' Tell the compiler what we will be setting the clock to (Mhz)
CONFIG MCLRE = OFF
CONFIG fOSC = INTIO67 ' Internal oscillator, IO on pins 6 and 7
INCLUDE "SetDigitalIO.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
INCLUDE "utils.bas"
INCLUDE "convert.bas"   //xxxxx

 //DIM led(7) AS BYTE //xxxx                     
// variable declaration                               
DIM x AS BYTE
DIM y AS BYTE
DIM index AS BYTE 


//DIM rows AS BYTE
//DIM colums AS BYTE
//DIM i AS BYTE
CONST Row_data(8)AS BYTE = (%00000001,%00000010,%00000100,%00001000,%00010000,%00100000,%01000000,%10000000)              

CONST Red_Data(8) AS BYTE = (%11111110,%11111101,%11111011,%11110111,%11101111,%11011111,%10111111,%01111111)
CONST GREEN_data(8)AS BYTE = (%00000000,%00011111,%00010000,%00001100,%00001100,%00010000,%00011111,%00000000) 
const M_data(8)as byte = (%00000000,%00011111,%00010000,%00001100,%00001100,%00010000,%00011111,%00000000)
OSCCON = %01100000 ' Internal oscillator running at 8mHz
CM1CON0 = 0 ' set ports to digital
CM2CON0 = 0 '
ANSEL = 0 '
ANSELH = 0 '
TRISA = %00000000 ' PORTA outputs
TRISB = %00000000 ' PORTB outputs
TRISC = %00000000 ' PORTC outputs

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




// Start Of Program
SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTC all outputs
TRISB = %00000000                   // Make PORTB all outputs
TRISA = %00000000
// Main Loop
WHILE True()
 FOR x = 0 TO 7 
 FOR y = 0 TO 7
   portA=%11111111                     //turns off portA  GREEN
   portC = Row_data(x)//=Anodes_data(y)
   portB=M_Data(x)
   //portB.0=0 // = GREEN_data(x) 
   DELAYMS(50)
  // portC = %11111111
  // DELAYMS(500)
   NEXT
 NEXT
WEND                              
{
WHILE true
 FOR i = 0 TO 7
 PORTB.Bits(i) = 1
 portC.1 = 1
 DELAYMS(500)
 PORTB.Bits(i) = 0 
 NEXT
 WEND 
 }

 




//END SUB 

 {
//DIM rows AS  BYTE
DIM colums AS BYTE
DIM i AS BYTE
//SUB RightToLeft()
// DIM i AS BYTE
WHILE true
 FOR i = 0 TO 7
 PORTB.Bits(i) = 1
 portC.1 = 1
 DELAYMS(500)
 PORTB.Bits(i) = 0 
 NEXT
 WEND
//END SUB}

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Christmas ornament project

Post by bitfogav » Sun Nov 20, 2016 7:24 pm

I see you are disabling MCLR then.

Code: Select all

CONFIG MCLRE = OFF
You need to look at Multiplexing, that's how these matrix displays are controlled. here is a website that may help explain the process.
How Does Led Matrix Work.
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Mon Nov 21, 2016 9:25 am

got this display to work right. I had the port bits set wrong. instead of a 1 I had a 0
I inserted at after each arry display a "multiplexing" turn off everything.
I tried your DELAYUS(0) and didn't get results??

Code: Select all

{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/19/2016                                                     *
*  Version : 1.0                                                            *
*  Notes   : Christmas matrix  
             turn off all is a form of multi plexing it smooths out the display                                                *
*          :                                                                *
*****************************************************************************
}
DEVICE = 18F24k20 ' Tell the compiler what chip we are using
CLOCK = 8 ' Tell the compiler what we will be setting the clock to (Mhz)
CONFIG MCLRE = OFF
CONFIG fOSC = INTIO67 ' Internal oscillator, IO on pins 6 and 7
INCLUDE "SetDigitalIO.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
INCLUDE "utils.bas"
INCLUDE "convert.bas"   //xxxxx

 //DIM led(7) AS BYTE //xxxx                     
// variable declaration                               
DIM x AS WORD
DIM y AS BYTE
DIM index AS BYTE 
DIM b(8) AS BYTE

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

//CONST Cathodes_Data(8) AS BYTE = (%00000000,%00011111,%00010000,%00001100,%00001100,%00010000,%00011111,%00000000)

CONST Cathodes_Data(9)AS BYTE = (%11111111,%11110000,%11101111,%11110011,%11101111,%11110000,%11111111,%11111111,%11111111)

// oscilator directive
OSCCON = %01100000 ' Internal oscillator running at 8mHz
CM1CON0 = 0 ' set ports to digital
CM2CON0 = 0 '
ANSEL = 0 '
ANSELH = 0 '
TRISA = %00000000 ' PORTA outputs
TRISB = %00000000 ' PORTB outputs
TRISC = %00000000 ' PORTC outputs

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




// Start Of Program
SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTC all outputs
TRISB = %00000000                   // Make PORTB all outputs
TRISA = %11111111
y = 0
porta = %11111111
// Main
'WHILE true
'FOR y = 0 TO 7
'FOR x = 0 TO 7
WHILE True
      portc = Anodes_data(0)     '0
      portb = Cathodes_Data(0)
      
      DELAYmS(10)
      portc = Anodes_data(8)     'turn off all
      portb = Cathodes_Data(8)
  //11111111111111111111111111   
       portc = Anodes_data(0)      '1
       portb = Cathodes_Data(0)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
      
       portc = Anodes_data(1)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
   //2222222222222222222222222    
       
       portc = Anodes_data(0)      '2
       portb = Cathodes_Data(2)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(1)        
       portb = Cathodes_Data(1)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       delayms(10)
       portc = Anodes_data(2)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
  //3333333333333333333333333333333333333
      // portc = %00000000
       portc = Anodes_data(0)     '3
       portb = Cathodes_Data(3)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
     
       portc = Anodes_data(1)      
       portb = Cathodes_Data(2)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(2)      
       portb = Cathodes_Data(1)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(3)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
         portc = %00000000
//44444444444444444444444444444444444444   
       portc = Anodes_data(0)        
       portb = Cathodes_Data(4)       '4
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(1)     
       portb = Cathodes_Data(3)
       DELAYMS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(2)      
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(3)      
       portb = Cathodes_Data(1)
       DELAYMS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(4)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
         'portc = %00000000
 //555555555555555555555555555555555555555555    
       portc = Anodes_data(0)        '5
       portb = Cathodes_Data(5)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       'portc = %00000000
       portc = Anodes_data(1)     
       portb = Cathodes_Data(4)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(2)      
       portb = Cathodes_Data(3)
       DELAYms(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(3)      
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(4)      
       portb = Cathodes_Data(1)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(5)       
       portb = Cathodes_Data(0)
       DELAYMS(100)
 '66666666666666666666666666666666666666666666
         'portc = %00000000
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(0)     '6
       portb = Cathodes_Data(6)
       
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(1)      
       portb = Cathodes_Data(5)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(2)      
       portb = Cathodes_Data(4)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(3)      
       portb = Cathodes_Data(3)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(4)     
       portb = Cathodes_Data(2)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(5)      
       portb = Cathodes_Data(1)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(6)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
 //777777777777777777777777777777777777777
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(0)      '7
       portb = Cathodes_Data(7)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(1)      
       portb = Cathodes_Data(6)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(2)      
       portb = Cathodes_Data(5)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(3)     
       portb = Cathodes_Data(4)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(4)      
       portb = Cathodes_Data(3)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(5)
       portb = Cathodes_Data(2)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(6)      
       portb = Cathodes_Data(1)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(7)     
       portb = Cathodes_Data(0)
       DELAYMS(100)
         //portc = %00000000
 //88888888888888888888888888888888888888  ROUTINES 8 & 9 are to finish out back end of letters
       
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(1)      '8
       portb = Cathodes_Data(7)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(2)      
       portb = Cathodes_Data(6)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(3)      
       portb = Cathodes_Data(5)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(4)     
       portb = Cathodes_Data(4)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(5)      
       portb = Cathodes_Data(3)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(6)     
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(7)      
       portb = Cathodes_Data(1)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(7)     
       portb = Cathodes_Data(0)
       DELAYMS(100)
       //  portc = %00000000
 //9999999999999999999999999999999999999
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(2)      '0
       portb = Cathodes_Data(7)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(3)      '0
       portb = Cathodes_Data(6)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(4)      '0
       portb = Cathodes_Data(5)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(5)     '0
       portb = Cathodes_Data(4)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(6)      '0
       portb = Cathodes_Data(3)
       DELAYmS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(7)      '0
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(7)      '0
       portb = Cathodes_Data(1)
       DELAYuS(10)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_data(7)     '0
       portb = Cathodes_Data(0)
       DELAYMS(100)
       portc = Anodes_data(8)     'turn off all
       portb = Cathodes_Data(8)
        
       //portc = %00000000       ' eliminate ghosting
   //  NEXT
   
   
WEND                  // Loop back to the while loop as long as we havent finished.

   

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Wed Nov 23, 2016 12:27 am

Well I got it working after I realized I failed to insert the oscillator directives
It scrolls really well and decided to measure the current on one cathode (I enabled most of one byte) and come up with .7 ma using 100 ohm resistors on cathodes. yes less than 1 ma (reconfirmed measuring one led and 300 ohm resistor to check meter).
thinking maybe using the K series pic might be helping in the led brightness department??
Need to order SMD resistors at 100 ohm (help conserve battery life a little)
Seen several references to putting the const data bytes into a buffer but ??
I need to cram my fonts together of some how make all the bytes into one sentence or row of bytes.
Got confirmation that Elecrow has shipped my boards today.

Code: Select all

//xxxxxxxxxxxxxxxxxxxxxxxxxx

DEVICE = 18F24k20 ' Tell the compiler what chip we are using
CLOCK = 8 ' Tell the compiler what we will be setting the clock to (Mhz)
CONFIG MCLRE = OFF
CONFIG fOSC = INTIO67 ' Internal oscillator, IO on pins 6 and 7
INCLUDE "SetDigitalIO.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
INCLUDE "utils.bas"
INCLUDE "convert.bas"   //xxxxx   




                                                                              
// Arrays

' LETTER K 
 

                               
  
 CONST Anodes_Data(9)AS BYTE = (%00000001,%00000010,%00000100,%00001000,%00010000,%00100000,%01000000,%10000000,%00000000)                               

                                
//CONST Cathodes_Data(9)AS BYTE = (%11111111,%11111111,%11100000,%11011011,%11011011,%11011011,%11100000,%11111111,%11111111)
                                  
CONST E_Data(9)AS BYTE =(%11111111,%11111111,%11000000,%11011010,%11011010,%11111110,%11111111,%11111111,%11111111)

CONST M_Data(9)AS BYTE =(%11111111,%11110000,%11101111,%11110011,%11101111,%11110000,%11111111,%11111111,%11111111)
                                  
CONST C_Data(9)AS BYTE =(%11111111,%10000000,%10111110,%10111110,%10111110,%10011110,%11111111,%11111111,%11111111)

CONST H_Data(9)AS BYTE =(%11111111,%10000000,%11110111,%11110111,%11110000,%11111111,%11111111,%11111111,%11111111)
                                  
CONST I_Data(9)AS BYTE =(%11111111,%11111111,%11111111,%11100000,%11111111,%11111111,%11111111,%11111111,%11111111)

CONST R_Data(9)AS BYTE =(%11111111,%11110000,%11101111,%11110111,%11111111,%11111111,%11111111,%11111111,%11111111)
                                  
CONST S_Data(9)AS BYTE =(%11111111,%11111100,%10000110,%10110110,%10110000,%10011111,%11111111,%11111111,%11111111)
                                  
CONST T_Data(9)AS BYTE =(%11111111,%11111111,%11101111,%11101111,%11100000,%11101111,%11101111,%11111111,%11111111)                               
                                  
CONST Y_Data(9)AS BYTE = (%11111111,%11111111,%11111110,%11101101,%11110011,%11110111,%11101111,%11111111,%11111111)
                                  

                                                                   
                                  
                                  
                                  
// variable declaration                              

DIM Cathodes_Data(9) AS BYTE
DIM index AS BYTE
DIM y AS BYTE
DIM x AS BYTE
               
// Sub Routines
 //Anodes_data(9) = L_M(7)
// oscilator directive
OSCCON = %01100000 ' Internal oscillator running at 8mHz
CM1CON0 = 0 ' set ports to digital
CM2CON0 = 0 '
ANSEL = 0 '
ANSELH = 0 '
TRISA = %00000000 ' PORTA outputs
TRISB = %00000000 ' PORTB outputs
TRISC = %00000000 ' PORTC outputs
             

// Start Of Program


SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTD all outputs
TRISB = %00000000                   // Make PORTB all outputs
trisA = %00000000
y = 0
portA = %11111111
// Main Loop
WHILE True()

   FOR x = 0 TO 6
   
          IF x = 0 THEN Cathodes_Data = H_Data
          END IF
  
          IF x = 1 THEN Cathodes_Data = C_Data
          END IF
          IF x = 2 THEN Cathodes_Data = M_Data
          END IF
          IF x = 3 THEN Cathodes_Data = R_Data
          END IF
          IF x = 4 THEN Cathodes_Data = S_Data
          END IF
          IF x = 5 THEN Cathodes_Data = T_Data
          END IF
          IF x = 6 THEN Cathodes_Data = Y_Data
  END IF
    
      portc = Anodes_Data(0)     '0
      portb = Cathodes_Data(0)
      
      DELAYMS(10)
      portc = Anodes_Data(8)     'turn off all
      portb = Cathodes_Data(8)
  //11111111111111111111111111   
       portc = Anodes_Data(0)      '1
       portb = Cathodes_Data(0)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
      
       portc = Anodes_Data(1)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
   //2222222222222222222222222    
       
       portc = Anodes_Data(0)      '2
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)        
       portb = Cathodes_Data(1)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       DELAYMS(10)
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
  //3333333333333333333333333333333333333
      // portc = %00000000
       portc = Anodes_Data(0)     '3
       portb = Cathodes_Data(3)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
     
       portc = Anodes_Data(1)      
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(1)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
         portc = %00000000
//44444444444444444444444444444444444444   
       portc = Anodes_Data(0)        
       portb = Cathodes_Data(4)       '4
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)     
       portb = Cathodes_Data(3)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(1)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
         'portc = %00000000
 //555555555555555555555555555555555555555555    
       portc = Anodes_Data(0)        '5
       portb = Cathodes_Data(5)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       'portc = %00000000
       portc = Anodes_Data(1)     
       portb = Cathodes_Data(4)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(3)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)      
       portb = Cathodes_Data(1)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)       
       portb = Cathodes_Data(0)
       DELAYMS(100)
 '66666666666666666666666666666666666666666666
         'portc = %00000000
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(0)     '6
       portb = Cathodes_Data(6)
       
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)      
       portb = Cathodes_Data(5)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(4)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(3)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)     
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)      
       portb = Cathodes_Data(1)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(6)      
       portb = Cathodes_Data(0)
       DELAYMS(100)
 //777777777777777777777777777777777777777
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(0)      '7
       portb = Cathodes_Data(7)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)      
       portb = Cathodes_Data(6)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(5)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)     
       portb = Cathodes_Data(4)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)      
       portb = Cathodes_Data(3)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(6)      
       portb = Cathodes_Data(1)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)     
       portb = Cathodes_Data(0)
       DELAYMS(100)
         //portc = %00000000
 //88888888888888888888888888888888888888  ROUTINES 8 & 9 are to finish out back end of letters
       
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)      '8
       portb = Cathodes_Data(7)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(6)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(5)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)     
       portb = Cathodes_Data(4)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)      
       portb = Cathodes_Data(3)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(6)     
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)      
       portb = Cathodes_Data(1)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)     
       portb = Cathodes_Data(0)
       DELAYMS(100)
       //  portc = %00000000
 //9999999999999999999999999999999999999
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      '0
       portb = Cathodes_Data(7)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      '0
       portb = Cathodes_Data(6)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)      '0
       portb = Cathodes_Data(5)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)     '0
       portb = Cathodes_Data(4)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(6)      '0
       portb = Cathodes_Data(3)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)      '0
       portb = Cathodes_Data(2)
       DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)      '0
       portb = Cathodes_Data(1)
       DELAYUS(10)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)     '0
       portb = Cathodes_Data(0)
       DELAYMS(100)
       portc = Anodes_Data(8)     'turn off all
       portb = Cathodes_Data(8)
        
       //portc = %00000000       ' eliminate ghosting
     NEXT
   
   
WEND                  // Loop back to the while loop as long as we havent finished.

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Sat Nov 26, 2016 9:23 am

HELP!!!
I am going nuts trying to get this dang thing to scroll. At this point I am getting nothing on the matrix
using an example from your site but I must have screwed up somewhere??

Code: Select all

{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/25/2016                                                     *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
DEVICE = 18F24k20 ' Tell the compiler what chip we are using
CLOCK = 8 ' Tell the compiler what we will be setting the clock to (Mhz)
CONFIG MCLRE = OFF
CONFIG fOSC = INTIO67 ' Internal oscillator, IO on pins 6 and 7
INCLUDE "SetDigitalIO.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
INCLUDE "utils.bas"
INCLUDE "convert.bas"   //xxxxx   

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
DIM led AS portA.2
DIM led2 AS portC.2
//DIM Sentence_Data(8) AS BYTE
CONST Anodes_data(8)AS BYTE = (%00000001,%00000010,%00000100,%00001000,%00010000,%00100000,%01000000,%10000000)              
//CONST Sentence_Data(96) AS BYTE =    (%00000111,%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)
CONST Sentence_Data(8) AS BYTE = (%11111110,%11111101,%11111011,%11110111,%11101111,%11011111,%10111111,%01111111)
//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




// Start Of Program
SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTC all outputs
TRISB = %00000000                   // Make PORTB all outputs
OSCCON = %01100000 ' Internal oscillator running at 8mHz
CM1CON0 = 0 ' set ports to digital
CM2CON0 = 0 '
ANSEL = 0 '
ANSELH = 0 '

// Main Loop
WHILE True()
      Draw_Data ()
      FOR y = 0 TO 20
      Draw_Data()
      NEXT
      Scroll_Text()
WEND                              
 

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by brad » Sat Nov 26, 2016 8:32 pm

just so I am following along, you currently have nothing being displayed on the matrix - and the circuit you are using is exactly the same as the design files you posted, is that right?

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Sun Nov 27, 2016 12:52 am

yes and yes
The design schematic I posted might not of had the resistors on the anodes on portc
something really going wrong??
am wondering if I inserted a 18f2420 and not the 24K20 maybe the ossc settings or ?? settings but I ??? it.
had other codes I posted that worked.

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Sun Nov 27, 2016 5:52 am

I think I found an issue
the anodes are never used within the code??

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Mon Nov 28, 2016 2:51 pm

trying a different approach by trying a code that was supposed to work but??
really need help to get the dang code to display text smoothly if possible You might reconize some bits of code from your projects.

Code: Select all

*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/27/2016                                                     *
*  Version : 1.0                                                            *
*  Notes   :my code from brads  need to insert const arrays                                                                *
*          :                                                                *
*****************************************************************************
}
DEVICE = 18F24K20        
CLOCK = 32                            
CONFIG MCLRE = OFF          
CONFIG FOSC = intio67      
INCLUDE "SetDigitalIO.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
INCLUDE "utils.bas"
INCLUDE "convert.bas"   //xxxxx
INCLUDE "shift.bas"


DIM Scroll_Speed AS INTEGER
DIM x AS BYTE
DIM y AS BYTE
 CONST Anodes_Data(9)AS BYTE = (%00000001,%00000010,%00000100,%00001000,%00010000,%00100000,%01000000,%10000000,%00000000)                               

                                
//CONST Cathodes_Data(9)AS BYTE = (%11111111,%11111111,%11100000,%11011011,%11011011,%11011011,%11100000,%11111111,%11111111)
 {                                
 CONST M_Data(8)AS BYTE =(%11111111,%11110000,%11101111,%11110111,%11101111,%11110000,%11111111,%11111111) 
 CONST E_Data(8)AS BYTE =(%11111111,%11111111,%11100000,%11101010,%11101110,%11111111,%11111111,%11111111) 
 CONST R_Data(8)AS BYTE =(%11111111,%11111111,%11110000,%11101111,%11101111,%11110111,%11111111,%11111111)
 
// CONST R_Data(8)AS BYTE =(%11111111,%11111111,%11100000,%11111011,%11111011,%11100000,%11111111,%11111111)
 CONST Y_Data(8)AS BYTE =(%11111111,%11111111,%11111110,%11101101,%11110011,%11110111,%11101111,%11111111) 
 CONST C_Data(8)AS BYTE =(%11111111,%11111111,%11100001,%11011110,%11011110,%11011110,%11111111,%11111111) 
 CONST H_Data(8)AS BYTE =(%11111111,%11111111,%11100000,%11111011,%11111011,%11100000,%11111111,%11111111)
 CONST I_Data(8)AS BYTE =(%11111111,%11111111,%11111111,%11100000,%11111111,%11111111,%11111111,%11111111)
 CONST S_Data(8)AS BYTE =(%11111111,%11111111,%11110010,%11101010,%11101000,%11111111,%11111111,%11111111) 
                                                                  
 CONST A_Data(8)AS BYTE =(%11111111,%11111111,%11110000,%11101011,%11101011,%11110000,%11111111,%11111111)                                  
 CONST T_Data(8)AS BYTE =(%11111111,%11101111,%11101111,%11100000,%11101111,%11101111,%11111111,%11111111)                                  
 CONST space(8)AS BYTE = (%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111)         
  }                                
 
CONST Cathodes_Data(88)AS BYTE = (%11100001,%11011111,%11101111,%11011111,%11100001,%11111111,%11111111,%11000001, // M
                                  %11010101,%11010101,%11011101,%11111111,%11111111,%11100001,%11011111,%11011111,
                                  %11101111,%11111111,%11111111,%11100001,%11011111,%11011111,%11101111,%11111111,
                                  %11111111,%11011111,%11101111,%11110001,%11101111,%11011111,%11111111,%11111111,
                                  %11111111,%11111111,%11000001,%11011101,%11011101,%11111111,%11111111,%11000001,
                                  %11111111,%11110111,%11110111,%11000001,%11111111,%11111111,%11100001,%11011111,// H r
                                  %11011111,%11011111,%11101111,%11111111,%11111111,%11000001,%11111111,%11111111,//  I
                                  %11111111,%11000110,%11010110,%11010110,%11010000,%11111111,%11111111,%11011111,//  s t
                                  %11011111,%11011111,%11000001,%11011111,%11011111,%11111111,%11111111,%11100001,//  t m
                                  %11011111,%11101111,%11011111,%11000001,%11111111,%11111111,%11100001,%11011011,// m A
                                  %11011011,%11100001,%11111111,%11111111,%11000101,%11010101,%11010001,%11111111)// A s





SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTD all outputs
TRISB = %00000000 
OSCCON = %01100000          
OSCTUNE.bits(6) = 1         

PORTC.bits(3) = 1
TRISA = %00001111           
TRISB = %00000000           
TRISC = %00000100           

ADCON0 = %00000001          
ADCON1 = %00000000        
ADCON2 = %11110011          

Scroll_Speed = 200
 y = 0
 porta = %11111111
WHILE true
   
   FOR x = 0 TO 7
      portc = %00000000
      portc = Anodes_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 <88 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: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by brad » Wed Nov 30, 2016 9:44 pm

I apologise for not being around much, hopefully this coming weekend i'll have some spare time to sit down and have a good look at your code and even test it out on some hardware.

MrDEB
I practically live here!
I practically live here!
Posts: 372
Joined: Fri Feb 18, 2011 4:24 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Christmas ornament project

Post by MrDEB » Thu Dec 01, 2016 12:15 am

enn hacking and added a couple of sub routines so green and red are enabled. There's got to be a way to get rid of all the code repetitiveness but time is getting short and as soon as my boards arrive it's assembly time.
here is my code to data customized for my brother.
NOTE every time I post a code I get a pm about using { instead of the square brackets??

Code: Select all

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


//xxxxxxxxxxxxxxxxxxxxxxxxxx

DEVICE = 18F24k20 ' Tell the compiler what chip we are using
CLOCK = 8 ' Tell the compiler what we will be setting the clock to (Mhz)
CONFIG MCLRE = OFF
CONFIG fOSC = INTIO67 ' Internal oscillator, IO on pins 6 and 7
INCLUDE "SetDigitalIO.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
INCLUDE "utils.bas"
INCLUDE "convert.bas"   //xxxxx   




                                                                              
// Arrays


 

                               
  
 CONST Anodes_Data(9)AS BYTE = (%00000001,%00000010,%00000100,%00001000,%00010000,%00100000,%01000000,%10000000,%00000000)
 
                                

                                
CONST A_Data(8)AS BYTE = (%11111111,%11111111,%11100000,%11011011,%11011011,%11011011,%11100000,%11111111)
                                  
CONST E_Data(8)AS BYTE =(%11111111,%11111111,%11100000,%11101010,%11101110,%11111111,%11111111,%11111111)

CONST M_Data(8)AS BYTE =(%11111111,%11110000,%11101111,%11110011,%11101111,%11110000,%11111111,%11111111)
                                  
CONST C_Data(8)AS BYTE =(%11111111,%11100001,%11011110,%11011110,%11011110,%11111111,%11111111,%11111111)

CONST H_Data(8)AS BYTE =(%11111111,%11111111,%11100000,%11111011,%11111011,%11100000,%11111111,%11111111)
                                  
CONST I_Data(8)AS BYTE =(%11111111,%11111111,%11111111,%11100000,%11111111,%11111111,%11111111,%11111111)

CONST R_Data(8)AS BYTE =(%11111111,%11110000,%11101111,%11101111,%11110111,%11111111,%11111111,%11111111)

                                  
CONST S_Data(8)AS BYTE =(%11111111,%11111111,%11100110,%11010110,%11010110,%11011000,%11111111,%11111111)
                                  
CONST T_Data(8)AS BYTE =(%11111111,%11111111,%11101111,%11101111,%11100000,%11101111,%11101111,%11111111)                               
                                  
CONST Y_Data(8)AS BYTE = (%11111111,%11101111,%11110111,%11111000,%11110111,%11101111,%11111111,%11111111)

CONST Space (8) AS BYTE =(%11111111,%11111111,%11111111,%11111111,%11111111,%10011111,%11111111,%11111111)
'' personalized CUSTOM ARRAYS                                  
    CONST T2_data (8)AS BYTE =(%11111111,%11011111,%11011111,%11000001,%11011111,%11011111,%11111111,%11111111)

    CONST O_data(8) AS BYTE =(%11111111,%11111111,%11100011,%11011101,%11011101,%11100011,%11111111,%11111111)

    CONST M2_data(8) AS BYTE =(%11111111,%11110001,%11101111,%11110111,%11101111,%11110001,%11111111,%11111111)


    CONST N_data(8) AS BYTE =(%11111111,%11111111,%11100001,%11110111,%11111011,%11100001,%11111111,%11111111)

    CONST L_data(8) AS BYTE =(%11111111,%11111111,%11000001,%11111101,%11111101,%11111111,%11111111,%11111111)


    CONST O2_data(8) AS BYTE =(%11111111,%11111111,%11100011,%11011101,%11011101,%11100011,%11111111,%11111111)

    CONST R2_data(8) AS BYTE =(%11111111,%11111111,%11100001,%11011111,%11011111,%11101111,%11111111,%11111111)


    CONST I2_data(8) AS BYTE =(%11111111,%11111111,%11111111,%11000001,%11111111,%11111111,%11111111,%11111111)



                                  
                                  
                                  
// variable declaration                              

DIM Cathodes_Data(9) AS BYTE
DIM index AS BYTE
DIM y AS BYTE
DIM x AS BYTE
DIM color AS BYTE               
// Sub Routines
SUB GREEN()
 FOR x = 0 TO 23
   SELECT x
          CASE 0 Cathodes_Data = M_Data
  
          CASE 1 Cathodes_Data = E_Data
   
           CASE 2 Cathodes_Data = R_Data
   
           CASE 3 Cathodes_Data = R_Data
   
           CASE 4 Cathodes_Data = Y_Data
           CASE 5 Cathodes_Data = Space
           CASE 6 Cathodes_Data = C_Data
  
          CASE 7 Cathodes_Data = H_Data
   
          CASE 8 Cathodes_Data = R_Data
   
          CASE 9 Cathodes_Data = I_Data
   
          CASE 10 Cathodes_Data = S_Data
   
          CASE 11 Cathodes_Data = T_Data
   
          CASE 12 Cathodes_Data = M_Data
          CASE 13 Cathodes_Data = A_Data
          CASE 14 Cathodes_Data = S_Data
          CASE 15 Cathodes_Data = Space
          'xxxxxxxxxxxxxxxxxxxxxxxxxxx
          CASE 16 Cathodes_Data = T2_data
  
          CASE 17 Cathodes_Data = O_data
   
          CASE 18 Cathodes_Data = M2_data
   
          CASE 19 Cathodes_Data = N_data
   
          CASE 20 Cathodes_Data = L_data
           
          CASE 21 Cathodes_Data = O_data
  
          CASE 22 Cathodes_Data = R2_data
   
          CASE 23 Cathodes_Data = I2_data
   
        
  
  END SELECT
      
    portb = %11111111      // portb is off
      portc = Anodes_Data(0)     '0
      porta = Cathodes_Data(0)
      
     DELAYMS(10)
      portc = Anodes_Data(8)   'turn off all
      'porta = %11111111
  //11111111111111111111111111   
       portc = Anodes_Data(0)      '1
       porta = Cathodes_Data(0)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       'porta = %11111111
      
       portc = Anodes_Data(1)      
       porta = Cathodes_Data(0)
       DELAYMS(60)
       portc = Anodes_Data(8)     'turn off all
       'porta = %11111111
   //2222222222222222222222222    
       
       portc = Anodes_Data(0)      '2
       porta = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8) 'turn off all
      
       portc = Anodes_Data(1)        
       porta = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
      DELAYMS(10)
       portc = Anodes_Data(2)      
       porta = Cathodes_Data(0)
       DELAYMS(60)
       portc = Anodes_Data(8)      'turn off all
       
  //3333333333333333333333333333333333333
      // portc = %00000000
       portc = Anodes_Data(0)     '3
       porta = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       portc = Anodes_Data(1)      
       porta = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(2)      
       porta = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(3)      
       porta = Cathodes_Data(0)
       DELAYMS(60)
         portc = %00000000
//44444444444444444444444444444444444444   
       portc = Anodes_Data(0)        
       porta = Cathodes_Data(4)       '4
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       
       
       portc = Anodes_Data(1)     
       porta = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all

       
       portc = Anodes_Data(2)      
       porta = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(3)      
       porta = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(4)      
       porta = Cathodes_Data(0)
       DELAYMS(60)
         
 //555555555555555555555555555555555555555555    
       portc = Anodes_Data(0)        '5
       porta = Cathodes_Data(5)
      
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       portc = Anodes_Data(1)     
       porta = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(2)      
       porta = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
      
       
       portc = Anodes_Data(3)      
       porta = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(4)      
       porta = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(5)
              
       porta = Cathodes_Data(0)
       DELAYMS(60)
 '66666666666666666666666666666666666666666666

       portc = Anodes_Data(8)     'turn off all
       
       
       portc = Anodes_Data(0)     '6
       porta = Cathodes_Data(6)
       
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(1)      
       porta = Cathodes_Data(5)
      
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(2)      
       porta = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all

       
       portc = Anodes_Data(3)      
       porta = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all

       
       portc = Anodes_Data(4)     
       porta = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(5)      
       porta = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all

       
       portc = Anodes_Data(6)      
       porta = Cathodes_Data(0)
       DELAYMS(60)
 //777777777777777777777777777777777777777
       portc = Anodes_Data(8)      'turn off all
 
       
       portc = Anodes_Data(0)      '7
       porta = Cathodes_Data(7)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all

       
       portc = Anodes_Data(1)      
       porta = Cathodes_Data(6)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(2)      
       porta = Cathodes_Data(5)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(3)     
       porta = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all

       
       portc = Anodes_Data(4)      
       porta = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(5)
       porta = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       portc = Anodes_Data(6)      
       porta = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(7)     
       porta = Cathodes_Data(0)
       DELAYMS(60)
         
 //88888888888888888888888888888888888888  ROUTINES 8 & 9 are to finish out back end of letters
       
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(1)      '8
       porta = Cathodes_Data(7)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
 
       
       portc = Anodes_Data(2)      
       porta = Cathodes_Data(6)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(3)      
       porta = Cathodes_Data(5)
      DELAYMS(10)
       portc = Anodes_Data(8)    'turn off all
      
       
       portc = Anodes_Data(4)     
       porta = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(5)      
       porta = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(6)     
       porta = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(7)      
       porta = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
 
       
       portc = Anodes_Data(7)     
       porta = Cathodes_Data(0)
       DELAYMS(60)
 
 //9999999999999999999999999999999999999
       portc = Anodes_Data(8)     'turn off all
       
       
       portc = Anodes_Data(2)      '0
       porta = Cathodes_Data(7)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      
       
       portc = Anodes_Data(3)      '0
       porta = Cathodes_Data(6)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
 
       
       portc = Anodes_Data(4)      '0
       porta = Cathodes_Data(5)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(5)     '0
       porta = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
 
       
       portc = Anodes_Data(6)      '0
       porta = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
 
       
       portc = Anodes_Data(7)      '0
       porta = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)    'turn off all
 
       
       portc = Anodes_Data(7)      '0
       porta = Cathodes_Data(1)
       DELAYUS(10)
       portc = Anodes_Data(8)      'turn off all
       
       
       portc = Anodes_Data(7)     '0
       porta = Cathodes_Data(0)
       DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
     
     NEXT
   END SUB                  

 SUB RED()
 FOR x = 0 TO 14
   SELECT x
          CASE 0 Cathodes_Data = M_Data
  
           CASE 1 Cathodes_Data = E_Data
   
           CASE 2 Cathodes_Data = R_Data
   
           CASE 3 Cathodes_Data = R_Data
   
           CASE 4 Cathodes_Data = Y_Data
           CASE 5 Cathodes_Data = Space
           CASE 6 Cathodes_Data = C_Data
  
           CASE 7 Cathodes_Data = H_Data
   
           CASE 8 Cathodes_Data = R_Data
   
           CASE 9 Cathodes_Data = I_Data
   
           CASE 10 Cathodes_Data = S_Data
   
           CASE 11 Cathodes_Data = T_Data
   
           CASE 12 Cathodes_Data = M_Data
           CASE 13 Cathodes_Data = A_Data
           CASE 14 Cathodes_Data = S_Data
         
  
  END SELECT
      
    portA = %11111111      // porta is off
      portc = Anodes_Data(0)     '0
      portb = Cathodes_Data(0)
      
     DELAYMS(10)
      portc = Anodes_Data(8)   'turn off all
      'portb = %11111111
  //11111111111111111111111111   
       portc = Anodes_Data(0)      '1
       portb = Cathodes_Data(0)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       'portb = %11111111
      
       portc = Anodes_Data(1)      
       portb = Cathodes_Data(0)
       DELAYMS(60)
       portc = Anodes_Data(8)     'turn off all
       'portb = %11111111
   //2222222222222222222222222    
       
       portc = Anodes_Data(0)      '2
       portb = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8) 'turn off all
      ' portb =%11111111
       
       portc = Anodes_Data(1)        
       portb = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
      DELAYMS(10)
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(0)
       DELAYMS(60)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
  //3333333333333333333333333333333333333
      // portc = %00000000
       portc = Anodes_Data(0)     '3
       portb = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
     
       portc = Anodes_Data(1)      
       portb = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(0)
       DELAYMS(60)
         portc = %00000000
//44444444444444444444444444444444444444   
       portc = Anodes_Data(0)        
       portb = Cathodes_Data(4)       '4
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)     
       portb = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)      
       portb = Cathodes_Data(0)
       DELAYMS(60)
         'portc = %00000000
 //555555555555555555555555555555555555555555    
       portc = Anodes_Data(0)        '5
       portb = Cathodes_Data(5)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       'portc = %00000000
       portc = Anodes_Data(1)     
       portb = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)      
       portb = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)       
       portb = Cathodes_Data(0)
       DELAYMS(60)
 '66666666666666666666666666666666666666666666
         'portc = %00000000
       portc = Anodes_Data(8)     'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(0)     '6
       portb = Cathodes_Data(6)
       
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)      
       portb = Cathodes_Data(5)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)     
       portb = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)      
       portb = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(6)      
       portb = Cathodes_Data(0)
       DELAYMS(60)
 //777777777777777777777777777777777777777
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(0)      '7
       portb = Cathodes_Data(7)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)      
       portb = Cathodes_Data(6)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(5)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)     
       portb = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)      
       portb = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)
       portb = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(6)      
       portb = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)     
       portb = Cathodes_Data(0)
       DELAYMS(60)
         //portc = %00000000
 //88888888888888888888888888888888888888  ROUTINES 8 & 9 are to finish out back end of letters
       
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(1)      '8
       portb = Cathodes_Data(7)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      
       portb = Cathodes_Data(6)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      
       portb = Cathodes_Data(5)
      DELAYMS(10)
       portc = Anodes_Data(8)    'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)     
       portb = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)      
       portb = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(6)     
       portb = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)      
       portb = Cathodes_Data(1)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)     
       portb = Cathodes_Data(0)
       DELAYMS(60)
       //  portc = %00000000
 //9999999999999999999999999999999999999
       portc = Anodes_Data(8)     'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(2)      '0
       portb = Cathodes_Data(7)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(3)      '0
       portb = Cathodes_Data(6)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(4)      '0
       portb = Cathodes_Data(5)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(5)     '0
       portb = Cathodes_Data(4)
      DELAYMS(10)
       portc = Anodes_Data(8)     'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(6)      '0
       portb = Cathodes_Data(3)
      DELAYMS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)      '0
       portb = Cathodes_Data(2)
      DELAYMS(10)
       portc = Anodes_Data(8)    'turn off all
      ' portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)      '0
       portb = Cathodes_Data(1)
       DELAYUS(10)
       portc = Anodes_Data(8)      'turn off all
       'portb = Cathodes_Data(8)
       
       portc = Anodes_Data(7)     '0
       portb = Cathodes_Data(0)
       DELAYMS(60)
       portc = Anodes_Data(8)      'turn off all
     NEXT
   END SUB                

   
// oscilator directive
OSCCON = %01100000 ' Internal oscillator running at 8mHz
CM1CON0 = 0 ' set ports to digital
CM2CON0 = 0 '
ANSEL = 0 '
ANSELH = 0 '

             

// Start Of Program


SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTD all outputs
TRISB = %00000000                   // Make porta all outputs
TRISA = %00000000
y = 0
color = 0
// Main Loop
WHILE True()
   FOR x = 0 TO 14
   SELECT x
           CASE 0 Cathodes_Data = M_Data
  
           CASE 1 Cathodes_Data = E_Data
   
           CASE 2 Cathodes_Data = R_Data
   
           CASE 3 Cathodes_Data = R_Data
   
           CASE 4 Cathodes_Data = Y_Data
           CASE 5 Cathodes_Data = Space
           CASE 6 Cathodes_Data = C_Data
  
           CASE 7 Cathodes_Data = H_Data
   
           CASE 8 Cathodes_Data = R_Data
   
           CASE 9 Cathodes_Data = I_Data
   
           CASE 10 Cathodes_Data = S_Data
   
           CASE 11 Cathodes_Data = T_Data
   
           CASE 12 Cathodes_Data = M_Data
           CASE 13 Cathodes_Data = A_Data
           CASE 14 Cathodes_Data = S_Data
         
  
  END SELECT
      GREEN()
      RED()
  NEXT
     WEND
    

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 13 guests