Show Posts
|
|
Pages: 1 [2] 3 4
|
|
16
|
Using Arduino / LEDs and Multiplexing / Re: TLC5940 Changine to Bit Banging and Move Blank Pin????
|
on: November 23, 2012, 10:17:42 am
|
|
So if i do a
digitalWrite(5,HIGH); digitalWrite(5,LOW);
(5 being the new BLANK Pin i want to use)
after the line of code which does the 4096 GSCLK pulses, this should give me the same result?
I just need to find the line of code that does the 4096 GSCLK pulses then? is that done in one of the libraries?
Then i should just grey out the line of code that does the original blank Pulse?
Thanks for the advice so far
Rich
|
|
|
|
|
17
|
Using Arduino / Networking, Protocols, and Devices / Re: Running 2 serial devices from an Arduino? CAN chip and TLC5940
|
on: November 23, 2012, 10:12:06 am
|
|
Yes i changed the code and the compliler brings up an error so it is deffinitely using that header file,
Im wondering if it is something to to with the fact that the hearer files include the SPI library,
And in the SPI library it defines the SS pin back through the Base Arduino Pin setup library as pin 10
Whcih makes me thing that it uses part of the SPI and Arduino.H library to carry out all of the CS functions?
I am soo confused lol
Rich
|
|
|
|
|
18
|
Using Arduino / LEDs and Multiplexing / Re: TLC5940 Changine to Bit Banging and Move Blank Pin????
|
on: November 23, 2012, 09:15:39 am
|
|
LOL, i am really trying to understand what the library does,
I have downloaded both the data sheet for the TLC5940, the MCP2515, and the Atmel processor But i seem to be going in loops and loops,
I have tried changing the MCP library where it defines the CS pin as 10, and changed it to 5, but the CAN chip no longer works,
I have searched other posts about moving the CS pin but i think the MCP calls the SPI library, and the SPI library references the SS pin back to the pins Arduino header, and i DONT want to go changing things in there lol
What do you think?
Thanks RIch
|
|
|
|
|
19
|
Using Arduino / Networking, Protocols, and Devices / Re: Running 2 serial devices from an Arduino? CAN chip and TLC5940
|
on: November 23, 2012, 06:20:22 am
|
|
Well what i have done as a test, is to use just the MCP wired to the Arduino, using its standard pins on the SPI except the CS pin which as you instructed, i changed that line in the code to pin 5, then i have wired the CS pin from the MCP to D5 on the Arduino and ran some code that i know works,
It doesnt seem to function with this change made,
Maybe i need to change that pin elsewhere in the Code?
sorry for all of the questions
Thansk so much for the assistance
Rich
|
|
|
|
|
23
|
Using Arduino / Networking, Protocols, and Devices / Re: Running 2 serial devices from an Arduino? CAN chip and TLC5940
|
on: November 22, 2012, 04:30:34 pm
|
|
This is the issue that I found, I very much appreciate your efforts on this , as a breakthrough would mean very much.
The MCP library is the one from the Seeduino wiki site. I will post a link tomorrow morning,
It looks like it uses the standard SPIN library supplied with the Arduino IDE, Which is why I thought it would be easier to chance the TLC library,
I really appreciate your help so far,
Rich
|
|
|
|
|
27
|
Using Arduino / LEDs and Multiplexing / Re: TLC5940 Changine to Bit Banging and Move Blank Pin????
|
on: November 22, 2012, 09:40:26 am
|
ok, so i have greyed out the /**#define set_XLAT_interrupt() TIFR1 |= _BV(TOV1); TIMSK1 = _BV(TOIE1) and /**#define enable_XLAT_pulses() TCCR1A = _BV(COM1A1) | _BV(COM1B1) in the Header File , correct? i have placed the new XLAT setup in the void setup after TLC.init90 as shown below??
#include "mcp_can.h" #include <SPI.h> #include <stdio.h> #define INT8U unsigned char
INT8U Flag_Recv = 0; INT8U len = 0; INT8U buf[8]; char str[20];
#include "Tlc5940.h" // LED DRiver chip Library
int i = 0;
int redArray[] = {0,3,6,9,12,15,18,21}; // Red LED Array int greenArray[] = {1,4,7,10,13,16,19,22}; // Green LED Array int blueArray[] = {2,5,8,11,14,17,20,23}; // Blue LED Array int maskBit = 1;
void setup()
{ Tlc.init(); // Initialise TLC LED Driver Chip TIFR1 |= _BV(TOV1); TIMSK1 = _BV(TOIE1);
CAN.begin(CAN_500KBPS); // init can bus : baudrate = 500k attachInterrupt(0, MCP2515_ISR, FALLING); // start interrupt }
void MCP2515_ISR() { Flag_Recv = 1; }
void loop()
{ Flag_Recv = 0; // clear flag CAN.readMsgBuf(&len, buf); // Recieve CAN Message maskBit = 1; // Start with Bit 00000001
for (i=0; i<8; i=i+1){ if ((255 & maskBit) > 0) { Tlc.set(redArray [i], 1000); // Write Red LED Bit ON Tlc.set(greenArray [i],0 ); // Write Green LED Bit ON Tlc.set(blueArray [i],0 ); // Write Blue LED Bit ON Tlc.update(); // Update the LED Driver Chip } else{ Tlc.set(redArray [i], 0); // Write Red LED Bit OFF Tlc.set(greenArray [i], 0); // Write Green LED Bit OFF Tlc.set(blueArray [i], 0); // Write Blue LED Bit OFF Tlc.update(); // Upadte the LED Driver Chip } maskBit = maskBit << 1; // Next Bit to check }
}
and do i need to change anything on the interupt? Thankyou soo much for all of your help so far  Rich
|
|
|
|
|
29
|
Using Arduino / Networking, Protocols, and Devices / Running 2 serial devices from an Arduino? CAN chip and TLC5940
|
on: November 22, 2012, 09:10:12 am
|
|
Has anyone run 2 Serial devices from an UNO?
I have the MCP CAN chip running on the SPI bus, and i need to add the TLC5940 LED driver chip which also runs on SPI
Now i know i can move the TLC to run in BIT BANG mode, but i still need to move the BLANK pin that the TLC uses as the CAN chip requires this too,
I am not competent enough to modify libraries so i was wondering if anyone can help me do this?
Many thanks
Rich
|
|
|
|
|
30
|
Using Arduino / LEDs and Multiplexing / Re: TLC5940 Changine to Bit Banging and Move Blank Pin????
|
on: November 22, 2012, 09:02:45 am
|
OK, i get the idea of what you are saying, I have found the items you mention in the .h libraby, but there are also mention of setting timers up in the .ccp file, Would this need to be changed too? i have copied the .h file below, i will try and edit the areas i think you mean, /* Copyright (c) 2009 by Alex Leone <acleone ~AT~ gmail.com>
This file is part of the Arduino TLC5940 Library.
The Arduino TLC5940 Library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Arduino TLC5940 Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with The Arduino TLC5940 Library. If not, see <http://www.gnu.org/licenses/>. */
#ifndef TLC5940_H #define TLC5940_H
/** \file Tlc5940 library header file. */
#include <stdint.h> #include "tlc_config.h"
#ifdef TLC_ATMEGA_8_H
/** Enables the Timer1 Overflow interrupt, which will fire after an XLAT pulse */ #define set_XLAT_interrupt() TIFR |= _BV(TOV1); TIMSK = _BV(TOIE1) /** Disables any Timer1 interrupts */ #define clear_XLAT_interrupt() TIMSK = 0
#else
/** Enables the Timer1 Overflow interrupt, which will fire after an XLAT pulse */ #define set_XLAT_interrupt() TIFR1 |= _BV(TOV1); TIMSK1 = _BV(TOIE1) Not sure how to permenantly set this??? /** Disables any Timer1 interrupts */ #define clear_XLAT_interrupt() TIMSK1 = 0
#endif
/** Enables the output of XLAT pulses */ //#define enable_XLAT_pulses() TCCR1A = _BV(COM1A1) | _BV(COM1B1) Have grayed this out?? /** Disables the output of XLAT pulses */ #define disable_XLAT_pulses() TCCR1A = _BV(COM1B1)
extern volatile uint8_t tlc_needXLAT; extern volatile void (*tlc_onUpdateFinished)(void); extern uint8_t tlc_GSData[NUM_TLCS * 24];
/** The main Tlc5940 class for the entire library. An instance of this class will be preinstantiated as Tlc. */ class Tlc5940 { public: void init(uint16_t initialValue = 0); void clear(void); uint8_t update(void); void set(TLC_CHANNEL_TYPE channel, uint16_t value); uint16_t get(TLC_CHANNEL_TYPE channel); void setAll(uint16_t value); #if VPRG_ENABLED void setAllDC(uint8_t value); #endif #if XERR_ENABLED uint8_t readXERR(void); #endif
};
void tlc_shift8_init(void); void tlc_shift8(uint8_t byte);
#if VPRG_ENABLED void tlc_dcModeStart(void); void tlc_dcModeStop(void); #endif
// for the preinstantiated Tlc variable. extern Tlc5940 Tlc;
#endif
As you can see, i am not quite up to speed at re-writing library code , just yet Thanks for the help tho  Rich
|
|
|
|
|