I have something outta place?? I checked my cheat sheet for correct layout of directives etc but??
note I have been attempting to get code written for an 18F 24K20 pic using Swordfish. Need to use internal oscalliator and PortA6 &7 as outputs
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
OSCCON = %01100000 ' Internal oscillator running at 8mHz
CM1CON0 = 0 ' set ports to digital
CM2CON0 = 0 '
ANSEL = 0 '
ANSELH = 0 '
//INCLUDE "SetDigitalIO.bas" // Include this file when we compile so that we can use keywords like 'setalldigital'
//INCLUDE "utils.bas"
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
Found a fix for my code that seems to work. Weather its right?? The matrix works or seems to.
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"
DIM rows AS BYTE
DIM colums AS BYTE
DIM i AS BYTE
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
WHILE true
FOR i = 0 TO 7
PORTB.Bits(i) = 1
portC.1 = 1
DELAYMS(500)
PORTB.Bits(i) = 0
NEXT
WEND
got this project going finally. after I get all the fonts inserted into th CONST arrays I want to add some green leds into the mix asnd then look into putting entire sentence into an array to fisplay on an 8 x 8 matrix
Code:
{
*****************************************************************************
* 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.