Christmas ornament project
Moderators: Chuckt, Garth, bitfogav
- brad
- 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
I just found some code from a number of years ago which should really help you out. It uses a different microcontroller however you should be able to simply change the ports to the ports you are using for the RED cathodes, Green cathodes and the common anodes - then change the microcontroller details, update clock settings etc.
Let me know how you go with this code - I hope it helps out.
Let me know how you go with this code - I hope it helps out.
-
- 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
your code really helped.
I changed the ports, eliminated portE and D, redid the const arrays and ran out of memory (too many bytes in the const arrays).
Thanks
I changed the ports, eliminated portE and D, redid the const arrays and ran out of memory (too many bytes in the const arrays).
Thanks
-
- 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
One big issue now is it cycles one time correctly then starts jumbeling text then freezes up.
thinking it is running out of memory with all the const arrays etc.
usiong an 18F24k20 pic
thinking it is running out of memory with all the const arrays etc.
usiong an 18F24k20 pic
Re: Christmas ornament project
Can you post you're current code so we can see what these "Const arrays" are..
If you don't know what Voltage your country is using, you shouldn't be doing electronics
-
- 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
here is the compressed file. It shouldn't matter that I had to rearrange the const data array bits as I mistakenly had the boards wired wrong (the first 4 bits had to be reversed) but it shouldn't make a difference.
going to try the code on my proto-type display to see if it locks up as well.
Looking at why are the constant arrays loaded more than one time?? maybe running out of memmory?
this code shows 685 program bytes used and 50 variables
going to try the code on my proto-type display to see if it locks up as well.
Looking at why are the constant arrays loaded more than one time?? maybe running out of memmory?
this code shows 685 program bytes used and 50 variables
- Attachments
-
- FirstScrollTest33.zip
- (2.36 KiB) Downloaded 603 times
Re: Christmas ornament project
I kind of find it hard that it's running out of memory?. Can you please upload the .bas file for the code please as the file you uploaded only contains the .idf file.
If you don't know what Voltage your country is using, you shouldn't be doing electronics
-
- 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
Code: Select all
' 8x8 RG Matrix Scrolling text test
' PORTB = RED LED Cathodes
' PORTB = GREEN LED Cathodes
' PORTC = Anodes
DEVICE = 18F24K20 ' Tell the compiler what chip we are using
CLOCK = 8 ' Tell the compiler what we will be setting the clock to (in Mhz)
CONFIG MCLRE = OFF
CONFIG FOSC = intio67 ' Internal oscillator, IO on pins 6 and 7
INCLUDE "utils.bas"
CONST RedData(105) AS BYTE = (%00110111,%01000000,%00100000,%01000000,%00110111,%00000000,%01110111,%01010100,
%01000010,%00000000,%01110111,%01000001,%01110010,%00000100,%00000000,%01111110,
%01000001,%01110001,%00000010,%00000100,%00000000,%01100000,%00010000,%00000111,
%00010000,%01100000,%00000000,%00000000,%00000000,%01110111,%01000100,%01000100,
%00000000,%01110111,%00010000,%00010000,%01110111,%00000000,%01110111,%01000001,
%00110010,%00000100,%00000000,%01110111,%00000000,%01110100,%01010100,%01010111,
%00000000,%01000000,%01000000,%01110111,%01000000,%01000000,%00000000,%00110111,
%01000000,%01000000,%00100000,%01000000,%01110111,%00000000,%00110111,%01010000,
%01010000,%01110111,%00000000,%01110100,%01010100,%01010111,%00000000,%00000000,// custom
%01110111,%01010100,%01000100,%00000000,%01110111,%00000100,%00000100,%00000000,
%01110111,%01010100,%01000100,%00000000,%01110111,%01000100,%01000100,%00000000,
%01110111,%01000001,%01110010,%00000100,%00000000,%00110011,%01000100,%01000100,
%00110010,%00000000,%01110111,%00000100,%00000011,%00000100,%01110111,%00000000,
%00000000)
''CONST GreenData(105) AS BYTE = (%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111100,%10000010,%10000010,%01000100,%00000000,%11111110,%00010000,%00010000,%11111110,%00000000,%11111110,%00010010,%00010010,%11101100,%00000000,%10000010,%11111110,%10000010,%00000000,%01001100,%10010010,%10010010,%01100100,%00000000,%00000010,%11111110,%00000010,%00000000,%11111110,%00000100,%00011000,%00000100,%11111110,%00000000,%11111100,%00010010,%11111100,%00000000,%01001100,%10010010,%10010010,%01100100,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000)
DIM RedLEDs AS PORTb
DIM GreenLEDs AS PORTa
DIM Anodes AS PORTC
DIM GreenBuffer(8) AS BYTE
DIM RedBuffer(8) AS BYTE
DIM x AS BYTE
DIM ScrollingTextOffset AS WORD
DIM ScrollingTextSpeed AS BYTE
DIM DefaultScrollingTextSpeed AS BYTE
SUB UpdateScrollingText()
IF ScrollingTextSpeed <> 0 THEN
DEC(ScrollingTextSpeed)
ELSE
ScrollingTextSpeed = DefaultScrollingTextSpeed
INC(ScrollingTextOffset)
IF ScrollingTextOffset > (BOUND(RedData) - 8) THEN ' we need to check if we have reached the start of the last eight columns of data that's why we take away 8
ScrollingTextOffset = 0
ENDIF
ENDIF
END SUB
SUB SaveGraphics()
FOR x = 0 TO 7
''GreenBuffer(x) = GreenData(x + ScrollingTextOffset)
RedBuffer(x) = RedData(x + ScrollingTextOffset)
NEXT
END SUB
SUB DisplayGraphics()
FOR x = 0 TO 7
''GreenLEDs = GreenBuffer(x) XOR %11111111
RedLEDs = RedBuffer(x) XOR %11111111
Anodes.bits(7 - x) = 1
DELAYUS(520)
Anodes.bits(7 - x) = 0
NEXT
END SUB
SetAllDigital
TRISA = %00000000 ' PORTA outputs
TRISB = %00000000 ' PORTB outputs
TRISC = %00000000 ' PORTC outputs
'TRISD = %00000000 ' PORTC outputs
'TRISE = %00000001 ' PORTC outputs except pin 0
// Start Of Program
OSCCON = %01100000 ' Internal oscillator running at 8mHz
'OSCTUNE.bits(6) = 1 ' enable PLL so we can run this thing at 32Mhz
//GreenLEDs = %00000000 ' we will be xor'ing the led data to make sure it sends logic 0's to turn on the LED
RedLEDs = %00000000 ' we will be xor'ing the led data to make sure it sends logic 0's to turn on the LED
Anodes = %00000000
ScrollingTextOffset = 0
DefaultScrollingTextSpeed = 45
ScrollingTextSpeed = DefaultScrollingTextSpeed
SaveGraphics
// Main Loop
WHILE True() // This creates an infinite loop
UpdateScrollingText
DisplayGraphics
WEND // Loop back to the while loop as long as we havent finished.
-
- 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
found that the code freezes when using battery power but not when pickit2 connected.????
Re: Christmas ornament project
I can only suspect that when using battery power that the BOR is resetting due to a low voltage.
Try adding the following to the code within you're CONFIG section:
Also is this the same fault as before? running out of memory???
Try adding the following to the code within you're CONFIG section:
Code: Select all
CONFIG BOREN = OFF
If you don't know what Voltage your country is using, you shouldn't be doing electronics
-
- 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
It is the same issue as when I thought?? it was / is a memory issue
will try your suggestion
will try your suggestion
Re: Christmas ornament project
Ok, well update us when you have tried adding the BOREN code. because I know Brads code works perfectly here on my hardware.
If you don't know what Voltage your country is using, you shouldn't be doing electronics
Re: Christmas ornament project
I guess the issue is now fixed with the BOREN = OFF..
http://sfcompiler.co.uk/phpBB3/viewtopic.php?f=3&t=2031
http://www.electro-tech-online.com/thre ... ix.149617/
http://sfcompiler.co.uk/phpBB3/viewtopic.php?f=3&t=2031
http://www.electro-tech-online.com/thre ... ix.149617/
If you don't know what Voltage your country is using, you shouldn't be doing electronics
-
- 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
YES thank you.
I just need to correct my schematic incase I decide to make more.
I have the first 4 bits connected to the matrix wrong
I just need to correct my schematic incase I decide to make more.
I have the first 4 bits connected to the matrix wrong
- brad
- 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
Sorry I'm just now back after a busy week. Good to see things are working out well and good pickup with the Brown Out Gav
-
- 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
Well here is an Alphabete file with upper / lower case letters. Did it in open office
hope you can use.
As for the brightness of the LED display, iy appearsd very bright. Could be using the 18F24K20 ??
hope you can use.
As for the brightness of the LED display, iy appearsd very bright. Could be using the 18F24K20 ??
- Attachments
-
- Alphabete.zip
- A to Z in binary
- (10.2 KiB) Downloaded 616 times
Who is online
Users browsing this forum: No registered users and 6 guests