Dot matrix

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hola every one
i'm gonna using a common anode dot matrix LED but i have a few problems
i wrote a code for this and i turn the each led in a row individually with 1 ms delay but by using this style when i want to turn all LEDs on in a row just LED1,2,7,8 will turn on

P.S:wanna Writing "H"

using ULN2803  for cathode pins

using micro pins directly for anode pins

 

this is my code :

int main(void)
{
	DDRB=0b11111111;//control the Row
	DDRC=0b11111111;//Control the Red Column
	DDRD=0b11111111;//Control the green column
	while(1)
	{
		// char H
		//Row 1 for H
		PORTB=0b00000001;//Row 1
		PORTC=0b00000001;//Column Red1
		_delay_ms(1);
		PORTB=0b00000001;//Row 1
		PORTC=0b00000010;//Column Red2
		_delay_ms(1);
		PORTB=0b00000001;//Row 1
		PORTC=0b01000000;//Column Red7
		_delay_ms(1);
		PORTB=0b00000001;//Row 1
		PORTC=0b10000000;//Column Red
		_delay_ms(1);
		// char H
		//Row 2 for H
		PORTB=0b00000010;//Row 2
		PORTC=0b00000001;//Column Red1
		_delay_ms(1);
		PORTB=0b00000010;//Row 2
		PORTC=0b00000010;//Column Red2
		_delay_ms(1);
		PORTB=0b00000010;//Row 2
		PORTC=0b01000000;//Column Red7
		_delay_ms(1);
		PORTB=0b00000010;//Row 2
		PORTC=0b10000000;//Column Red8
		_delay_ms(1);
		//Row 3 for H
		PORTB=0b00000100;//Row 3
		PORTC=0b00000001;//Column Red1
		_delay_ms(1);
		PORTB=0b00000100;//Row 3
		PORTC=0b00000010;//Column Red2
		_delay_ms(1);
		PORTB=0b00000100;//Row 3
		PORTC=0b01000000;//Column Red7
		_delay_ms(1);
		PORTB=0b00000100;//Row 3
		PORTC=0b10000000;//Column Red8
		_delay_ms(1);
		//Row 4 for H
		PORTB=0b00001000;//Row 4
		PORTC=0b00000001;//Column Red1
		_delay_ms(20);
		PORTB=0b00001000;//Row 4
		PORTC=0b00000010;//Column Red2
		_delay_ms(1);
		PORTB=0b00001000;//Row 4
		PORTC=0b00000100;//Column Red3
		_delay_ms(1);
		PORTB=0b00001000;//Row 4
		PORTC=0b00001000;//Column Red4
		_delay_ms(1);
		PORTB=0b00001000;//Row 4
		PORTC=0b00010000;//Column Red5
		_delay_ms(1);
		PORTB=0b00001000;//Row 4
		PORTC=0b00100000;//Column Red6
		_delay_ms(1);
		PORTB=0b00001000;//Row 4
		PORTC=0b01000000;//Column Red7
		_delay_ms(1);
		PORTB=0b00001000;//Row 4
		PORTC=0b10000000;//Column Red8
		_delay_ms(1);
		
		//Row 5 for H
		PORTB=(1<<4);//Row 5
		PORTC=0b00000001;//Column Red1
		_delay_ms(1);
		PORTB=(1<<4);//Row 5
		PORTC=0b00000010;//Column Red2
		_delay_ms(1);
		PORTB=(1<<4);//Row 5
		PORTC=0b00000100;//Column Red3
		_delay_ms(1);
		PORTB=(1<<4);//Row 5
		PORTC=0b00001000;//Column Red4
		_delay_ms(1);
		PORTB=(1<<4);;//Row 5
		PORTC=0b00010000;//Column Red5
		_delay_ms(1);
		PORTB=(1<<4);//Row 5
		PORTC=0b00100000;//Column Red6
		_delay_ms(1);
		PORTB=(1<<4);//Row 5
		PORTC=0b01000000;//Column Red7
		_delay_ms(1);
		PORTB=(1<<4);//Row 5
		PORTC=0b10000000;//Column Red8
		_delay_ms(1);
		//Row 6 for H
		PORTB=(1<<5);//Row 6
		PORTC=0b00000001;//Column Red1
		_delay_ms(1);
		PORTB=(1<<5);//Row 6
		PORTC=0b00000010;//Column Red2
		_delay_ms(1);
		PORTB=(1<<5);//Row 6
		PORTC=0b01000000;//Column Red7
		_delay_ms(1);
		PORTB=(1<<5);//Row 6
		PORTC=0b10000000;//Column Red8
		_delay_ms(1);
		//Row7
		PORTB=(1<<6);//Row 7
		PORTC=0b00000001;//Column Red1
		_delay_ms(1);
		PORTB=(1<<6);//Row 7
		PORTC=0b00000010;//Column Red2
		_delay_ms(1);
		PORTB=(1<<6);//Row 7
		PORTC=0b01000000;//Column Red7
		_delay_ms(1);
		PORTB=(1<<6);//Row 7
		PORTC=0b10000000;//Column Red8
		_delay_ms(1);
		
		//Row8
		PORTB=(1<<7);//Row 8
		PORTC=0b00000001;//Column Red1
		_delay_ms(1);
		PORTB=(1<<7);//Row 8
		PORTC=0b00000010;//Column Red2
		_delay_ms(1);
		PORTB=(1<<7);//Row 8
		PORTC=0b01000000;//Column Red7
		_delay_ms(1);
		PORTB=(1<<7);//Row 8
		PORTC=0b10000000;//Column Red8
		_delay_ms(1);
    }
}

tnks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LED1,2,7,8 will turn on

It's always good to say which microprocessor you are using but it looks like you are using a chip that has JTAG on portc, therefore the middle 4 bits are not usable unless you turn off JTAG, either by fuse or in firmware.

 

By the way I hope you are using series resistors with your leds or you will damage the port driving the anodes.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sorry MEGA16

yeah i used 220R resistors

 how i can do that??(turn of jTag

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We have all been looking for a way to do that for years. Usually we just dont use the jtag pins as IOs. Seems nutty doesn't ity? You think the datasheet has any reference to jtag enable and disable? I've never met anyone who has actually read the darn thing. Merry Christmas.

 

 

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 how i can do that??(turn of jTag

Uncheck the JTAG fuse with the programmer.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why not use the JTAG pins as JTAG pins??

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

so what??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

Why not use the JTAG pins as JTAG pins??

"Atmega16 consists of one JTAG port which shares four pins with PORTC. Until JTAG port is not disabled, these pins can’t be used as normal I/O pins"

JTAG can be permanently disabled by configuring two fuse bits, OCDEN and JTAGEN (must be disabled)

 

"tnQ JS"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 how i can do that??(turn of jTag

What else does it say in the datasheet about disabling JTAG?  I don't know where you got your "quotes" -- from the link?  At first read it sounds like a double-negative.

 

But apparently (as Bob's response is marked as a solution), you and Bob don't read datasheets?!?

 

 

Writing the JTD bit in the MCUCSR register to one or
leaving the JTAG fuse unprogrammed disables the JTAG interface.

 

ne"> • Bit 7 – JTD: JTAG Interface Disable
When this bit is zero, the JTAG interface is enabled if the JTAGEN Fuse is programmed. If this
bit is one, the JTAG interface is disabled. In order to avoid unintentional disabling or enabling of
the JTAG interface, a timed sequence must be followed when changing this bit: The application
software must write this bit to the desired value twice within four cycles to change its value.

 

...and other similar references.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But apparently (as Bob's response is marked as a solution), you and Bob don't read datasheets?!?

Lee:

Have another read of Bobs post. The humor is a bit subtle. Newbies never read the data sheets.

 

Last Edited: Mon. Dec 8, 2014 - 07:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The humor is a bit subtle.

Apparently, mine was >>too<< sublime.

 

While the quote that OP gave from http://www.engineersgarage.com/e... is confusing, clicking on the "Description" tab outlines disable methods nicely.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Mon. Dec 8, 2014 - 07:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I seem to remember Bob announcing that he had never used JTAG or debugWIRE in his life.

 

And in another post,  that he had owned two JTAGICE-mkIIs.

 

So anything is possible.    (especially my memory being totally wrong)

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

he had owned two JTAGICE-mkIIs.

Maybe more than 2 but simply used as programmers as I understand.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Still have em. Can you fix em?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yeah bob problem solved

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you fix em?

If it's just the transient protection blob at the back of the connector yes. Just send 2 fully paid return trip tickets to Florida + 1 week accommodation and I will come over to have a look.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly