Show Posts
Pages: [1] 2 3
1  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: August 22, 2008, 02:17:50 pm
Your project sounds impressive - does that mean you'll be controlling 3x30 led outputs?  are you going to need 6 TLC5940 to control the lot - or is it possible to multiplex the TLC5940 output pins?
2  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: August 08, 2008, 01:43:47 pm
My god - thanks, this is great... I've just ordered some of these from TI, and have been reading through the data-sheet trying to come up with a plan of attack.
3  Forum 2005-2010 (read only) / Development / Re: new wireless comms module on: May 06, 2008, 05:04:09 am
@mikem: Thanks for the info.  I'm not brave enough to go it alone yet, so I'm going to try to get some experience via the virtualwire library first smiley  I'm still very much a noob.

Does anyone know anywhere in the UK which sells RxB1 receivers and TxC1 transmitters?
4  Forum 2005-2010 (read only) / Development / Re: new wireless comms module on: May 05, 2008, 07:57:27 pm
Would something like http://www.simplesolutions-uk.com/datasheets/TXE-433-KH2_Transmitter%20data.pdf be suitable to use with the virtualwire library?
5  Forum 2005-2010 (read only) / Development / Re: Assembler for Arduino on: August 08, 2008, 01:28:38 pm
Hey - I just started with Atmel Assembly last night, and thought I'd post my experiences in case it helps anyone else (and to cement the info in my own mind) (thanks go to eadthem for help).

For my IDE, I used AVR Studio 3.5 (http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2724)

As I run linux, I needed to use wine... wasn't a problem doing so.  Wine decompresses to a folder in the fake 'windows/temp' directory.... you simply need to navigate and open '~/.wine/drive_c/windows/temp/cdrom/SETUP.EXE' which completes installation process.  After installation, Atmel Studio was available in application menu (Applications -> Wine -> Programs->Atmel AVR Tools->AVR Studio 3.56).

I'm using Atmega8, so I made sure I had the relevant datasheet at hand and the AVR 8-bit Instruction Set docs.

[*1] (http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf)

[*2] (http://www.atmel.com/dyn/resources/prod_documents/doc0856.pdf) <- pages 10 to 14 are especially relevant.

Okay, first task was to set-up a new project in AVR Studio.

Code:
Project -> new -> [give it a name] / [pick AVR assembler].

This creates a blank project.  Next we need a new text file to put our assembly code.

Code:
File -> new text file -> [give it the name 'main.asm']

As far as I know, the name isn't important - what _is_ important, is that when you right click the file, 'assembler entry file' is ticked.  You also need to drag this file into the Assembler Files folder.

Next, right click the route node of the project, and select the 'project settings'.  Change the output file format to 'intel hex'.  This defines the format that will eventually be used by the programmer software / board to upload the code to the microprocessor.

Okay - now it's on with the actual code.  Open up the text file created a few steps ago.

First stage is to set the start point in your program memory, to hex address 3A.

Code:
.ORG $3A

then..

Code:
START:      LDI      r16,high(ramend)      ;ramend=$025F p7-9
      OUT      sph,r16
      LDI      r16,low(ramend)
      OUT      spl,r16

It's worth running through some of the conventions here.  

The word preceding the colon, defines a point in the program code which can be called or jumped to later on.  It's used to allow us to call subroutines and create loops.

The semicolon defines a comment.

LDI and OUT are instructions ... (a full list of the AVR instruction set can be found in the guide linked above [*2], pages 10-14)

r16 is a register.  Registers can be though of as internal variables, which are able to be accessed very quickly by the processor; some are specific and can only be used in certain circumstances, while others are general purpose.

sph and spl refer to the AVR stack pointer (which is implemented as two 8-bit registers). The stack is a stack of data - you can add (push) data to the stack, or take (pop) data from the stack.  Find out more about the stack on page 13 of [*1].

As far as I can tell ramend, is a device specific constant, which refers to the end of the available data RAM.  

For this first program, I simply wanted to make an LED flash.  To do this, I need to output a HIGH signal followed by a LOW signal to one of the ports on the ATmega.

I was a bit confused here, thinking that port is another word for pin... it isn't.  The Atmega8 has three ports labelled BCD which are responsible for looking after 23 IO general purpose IO lines/pins.

Port B
------
looks after 8 I/O lines (PB7-0)

Port C
------
looks after 7 I/O lines (PC6-0) ... but note that PC6 is special case and is different to others, it's used as an IO pin or reset see page 5 of [*1] for more info.

Port D
------
looks after 8 I/O lines (PD7-0)

Each port pin consists of three register bits ( DDxn, PORTxn, PINxn).

DDxn bits are accessed at the DDRx I/O address, the PORTxn bits at the PORTx I/O address, and the PINxn bits at the PINx I/O address.

(N/B Page 65 of [*1] is a useful overview of how data is output (PORTxn), how pin direction is defined (DDRxn) and where input data is stored/accessed (PINxn), in relation to the available ports and pins.)

Because the ports and IO lines/pins are general purpose, we need to be able to define which are used for input and which are used for output.  This is done by setting the port direction.

Code:
     LDI r18,0b10000000
      OUT ddrb,r18

LDI is the instruction for 'load immediate', OUT is the instruction for 'out to i/o location'.

Next, we preload registers r18 and r19 with info that we'll use to make our LED flash... because we use these values many times, the assignment happens before the main loop.

Code:
     LDI r18,0b10000000; set register to pin 7 high
      LDI r19,0b00000000; set register to all pins low

Then the main loop ...

Code:
MAINLOOP:
      out portb,r18
      out portb,r19
      jmp MAINLOOP

Now, the great thing about AVR Studio - is that you can use it to run your code in a simulator, which allows you to debug the code, while monitoring the status of registers, i/o ports etc..

Before we can do this we need to include a file (giving device dependant info) at the beginning of the code. (inc files can be found in the 'Appnotes' subdirectory of yr AVR Studio install)

Code:
.include "m8def.inc"

Then select; Project -> Build and run... You'll need to select the chip you're working with.  Select View -> 'registers' & 'new io view'... then step through yr code with F10 and examine it's effect.
6  Forum 2005-2010 (read only) / Troubleshooting / Re: Can't upload sketch! on: August 14, 2009, 07:18:11 pm
I had a similar problem - and thought it was caused by sending out too much info on the serial port.

I ended up editing ~/.arduino/preferences.txt:

Code:
serial.debug_rate=9600

And this did the  trick.
7  Forum 2005-2010 (read only) / Troubleshooting / Re: LEDs on pins other than 13: resistor required? on: August 21, 2009, 08:41:41 am
Quote
It is rather like drinking alcohol. There are safe levels, dangerous levels and lethal levels.

Nice analogy  (.. but makes me feel very sorry for my liver smiley )
8  Forum 2005-2010 (read only) / Troubleshooting / Re: Did I just destroy my arduino? on: August 20, 2009, 03:45:18 pm
I used http://code.google.com/p/mega-isp/ without any problem...

no soldering, breadboard & jumper wire, a few leds (for op. status), a couple of bypass caps, one arduino and a bunch of blank chips.
9  Forum 2005-2010 (read only) / Troubleshooting / Re: Can burn bootloader only once? on: August 20, 2009, 03:35:31 pm
I think the problem is related what your fuses settings are requesting from your ATmega chip....

Some of the fuses define where the ATmega gets it's clock signal from... in the case of the lady ada guide, afaik she'll be assuming that you're getting your clock source from a 16Mhz external crystal - because this is the standard set-up for an Arduino board.

This means that your newly programmed ATmega chip is waiting patiently for an external clock source -> and unfortunately, until you give it one it's not going to play ball.

If you are suffering from the situation described above, you'll be given messages about 'no signature' and fuses will be automatically reset each time you try to reprogram yr ATmega.  

For a while I thought I'd fried a lot of my ICs but as soon as I set it up with an external clock source all was well.

(For a nice way of discovering fuse settings try out: http://www.engbedded.com/fusecalc/)
10  Forum 2005-2010 (read only) / Troubleshooting / Re: Burning Blank Atmega328 With Duemilanove on: August 15, 2009, 09:22:42 am
Not sure about this method - but last week I successfully used http://code.google.com/p/mega-isp/ to burn a bootloader onto an ATmega328p.

http://www.uchobby.com/index.php/2007/11/04/arduino-avr-in-system-programmer-isp/ describes it in more detail.

You don't need anything other than yr Arduino and a couple of bypass capacitors to get this working.
11  Forum 2005-2010 (read only) / Interfacing / Re: CPLD on: July 02, 2010, 05:32:39 pm
This is slightly off topic - but I was reading about FPGAs a while back and came across this site:

http://www.fpga4fun.com/

Seems it provides a nice introduction to the subject for beginners.

There's also a shop for sourcing development boards:

http://www.knjn.com/
12  Forum 2005-2010 (read only) / Interfacing / Re:  8x8 RGB Matrix + 2x TLC5940 + 4051? on: July 05, 2010, 08:08:21 am
Hey thanks - I'll have a look over yr code - the back-of-hand calculation helps a lot.    

Do you think I should use extra resistors for the red component of the RGB matrix?



13  Forum 2005-2010 (read only) / Interfacing / Re:  8x8 RGB Matrix + 2x TLC5940 + 4051? on: July 04, 2010, 11:45:36 am
Quote
The UDN2981A will source enough current for this LED matrix, but the chip is quite SLOW. If you intend to do fast PWM, you'll see ghost images. The information from row N will 'bleed' to N-1, N-2 etc. You can see this effect in my avatar's icon.

What frequency were you using for updating? I'm trying to work out what would constitute fast PWM.
14  Forum 2005-2010 (read only) / Interfacing / Re:  8x8 RGB Matrix + 2x TLC5940 + 4051? on: July 04, 2010, 10:36:02 am
Thanks for the heads-up.  

Can anything be done to improve the speed of a PNP darlington array?  Could there be an application circuit, that would give it it a speed boost?

Just asking as I now have the UDN2981s .. but I guess I should look into the M54564P (that the rainbowduino uses).

I read the following note on the datasheet:

Quote
Turn-off delay is influenced by load conditions. Systems  applications well below the specified output loading may require timing considerations for some designs, i.e., multiplexed displays or  when used in combination with sink drivers in a totem pole configuration.

All unused inputs must be connected to ground. Pulldown resistors ([ch8776] 10 k[ch937]) are recommended for inputs that are allowed to float while power is being applied to VS.

Does this mean I should use a pull down to ground on the UDN2981 output pins?  Could this maybe help with timing?
15  Forum 2005-2010 (read only) / Interfacing / Re:  8x8 RGB Matrix + 2x TLC5940 + 4051? on: July 03, 2010, 06:05:33 pm
Because the perf-board circuit is so difficult to read, I've drawn up the circuit using Eagle.  First time using Eagle - so apologies for the mess.


Pages: [1] 2 3