Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: Hexadec on Sep 09, 2012, 09:41 pm

Title: AS1130 First attempt - working
Post by: Hexadec on Sep 09, 2012, 09:41 pm
:smiley-mr-green:
For anyone interested in this chip here is some sample code.
This is an ongoing project and I'll update as I progress.

Feel free to alter and use it as you will...but please share your discoveries... :P


Edit 23/10/2012:
Please also see this post for better commented code http://arduino.cc/forum/index.php/topic,123071.0.html

Edit 30/10/2012: See post #113 for latest PWM demo.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 11, 2012, 12:01 pm
Latest version uploaded...with full 36 frame movie showing scrolling.

Working on picture animation next with PWM dataset.

Wish me luck  :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Sep 11, 2012, 05:57 pm
Hey this is great! I've only just received my breakout boards.
Could you please photograph your setup?  I'm still a little confused on the charlieplexing that it uses.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 11, 2012, 08:33 pm
Hi Funky

I got the chips from AMS and soldered one onto an adaptor board that I got from China (complete with header pins  :D) I then soldered all the components as per the diagram in my upload straight onto the adaptor board. This gave me a little plug-in unit that works as a module.

At present, this is plugged into a very old RS breadboard and driven by a R2 Uno.

This is my first time programming the Atmega chips but I've been programming PICs and micros for a long time.

I'll get some pics together but meanwhile  http://www.youtube.com/watch?v=qQ3lE_iK7_s&feature=g-upl (http://www.youtube.com/watch?v=qQ3lE_iK7_s&feature=g-upl) will give you an idea of the stripboard matrix and the sketch uploaded in this thread.

I have just made a Christmas tree (pretty crappy graphics) that demonstrate using 2 frames as pictures and 2 PWM sets to flash the lights.

I'll upload that soon for your perusal and I hope use.  :smiley-mr-green:

I think I've got this chip pretty well sussed out now and am just working on a simple spreadsheet to produce the graphics frames as binary data.

Have fun mate and success with your free samples.

ps I've just been shipped another 3.........what a cheek eh?  ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 11, 2012, 08:44 pm
On the subject of the cross-plexed matrix, here is how I simplified (!) the diagram to enable me to understand what was going on.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 11, 2012, 09:01 pm
Here's how the stripboard layout started.

Obviously all the LEDs are the same colour but in the pic they illustrate the direction of the cathodes on the board.

Green is cathode down and red is cathode up.

The reason they are soldered to one side is to enable me to solder the AS1130 and an ATMega328 on the same board and also to connect to a mirror image board to give me 24x11.

Also I've got lots of ideas for RGB matrices...but I can't face all that soldering at the moment.... :smiley-mr-green:

HTH
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 11, 2012, 09:10 pm
Okaly Dokaly...

Here's the demo using Picture mode and PWM sets.
http://www.youtube.com/watch?v=yx3FU0CgyPw (http://www.youtube.com/watch?v=yx3FU0CgyPw)

Source code is here:
Title: Re: AS1130 First attempt - working
Post by: graynomad on Sep 12, 2012, 05:36 pm
Interesting chip. All above saved for future reference.

______
Rob
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 12, 2012, 08:06 pm
Here's an interesting bit change that has lots of possibilities.....


http://www.youtube.com/watch?v=8BXjyxig61k (http://www.youtube.com/watch?v=8BXjyxig61k)
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Sep 24, 2012, 04:24 am
I am working on a board for the AS1130, what did you do with the SYNC and IRQ pins?  Did you pull them to logic low?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 24, 2012, 09:45 am
According to the datasheet IRQ should be pulled high but the sync is left floating.

I have emailed AMS about the IRQ line as all the chips I have stay at logic low even with a pull-up resistor. Whatever I try I can't get the IRQ to respond.

I haven't had a reply yet though....
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Sep 24, 2012, 05:26 pm
Aw crap, I pulled SYNC to ground on the boards.  I guess I can just cut the trace.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 24, 2012, 05:36 pm
Quote
I guess I can just cut the trace.


Unless you're using multiple chips I wouldn't bother...I pulled it low and high on different prototypes and it made no difference.

I haven't tried cascading them yet though.

Keep me informed of how you get on.  ;)
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Sep 24, 2012, 07:29 pm
Oh thank goodness.  The trace is super close to another one and I don't wanna mess it up.
Will do! 
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 24, 2012, 08:40 pm
If you check out the datasheet (page 28 Table 25) it shows that you have to physically set the sync_out or sync_in bits to get any response on pin 12.

In other words it's not a problem pulling it to VSS  8)


I've been working on this chip through an 18F4550 PIC for the last few days and have just added a 512Kbit EEPROM to swap out the frame data. The EEPROM holds 38 full datasets and you can flip the data on the fly.

Great fun this ain't it.... :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Sep 24, 2012, 11:00 pm
Oh wow, thats not a bad idea.  Do you just pull in frame data or how to you do the memory management?  Do you pull in the first frame, pull in the second, delete the first and pull in the third and so on?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 25, 2012, 07:32 am
Here's an example of dynamic data change using the internal EEPROM of a PIC18F4550 (256 bytes).
This gives a negative image of each frame.
I've included the reset routine as well. This is easily ported to Arduino code.


Code: [Select]
/***** Flip every bit in eeprom then write to AS1130 **************************/
void flipData(void)
{
printf(usb_cdc_putc, "Flipping Data:\r\n");
char i,j;
char data = 0;
char mask = 0b00000111;
char flipped;
for (i = 0; i <= 253; i+=2)    //size of eeprom
  {
    flipped = mask ^ read_eeprom(i);    
      write_eeprom(i, flipped);
   }
i = 254;
flipped = mask ^ read_eeprom(i);    
      write_eeprom(i, flipped);

mask = 0b11111111;
for (i=1; i <=253; i+=2)    //size of eeprom
  {
      flipped = mask ^ read_eeprom(i);    
      write_eeprom(i, flipped);
   }
printf(usb_cdc_putc, "Data Flipped:\r\n");          
  write_frame_data();
AS1130_reset();
}
/***** AS1130 Copy Frame Data from EEPROM *************************************/
void write_frame_data(void)
{
 char i, j, k;
 char data = 0;
for (i=FRAME0; i<=FRAME10; i++)    
  {
    for (j=0x00; j<=0x0B; j++)   // 0x00 to 0x0b are the Current Segments in each frame (CS0-CS11)
    {
      as_config(i, 2*j+1, read_eeprom(data));     // i = frame address, 2*j+1 = CS register address (odd numbers) then second data byte
      data++;
      as_config(i, 2*j,   read_eeprom(data));     // i = frame address, 2*j = CS register address (even numbers) then first data byte
      data++;      
    }
  }
}
/***** Restart AS1130 with changed settings ***********************************/
void AS1130_reset(void)
{
bit_clear(SHUTDOWNOPENSHORT_BYTE, 0);
bit_clear(SHUTDOWNOPENSHORT_BYTE, 1);
as_config(CONTROLREGISTER, SHUTDOWNOPENSHORT, SHUTDOWNOPENSHORT_BYTE);

       as_config(CONTROLREGISTER, MOVIEMODE, MOVIEMODE_BYTE);
  as_config(CONTROLREGISTER, DISPLAYOPTION, DISPLAYOPTION_BYTE);
as_config(CONTROLREGISTER, FRAMETIME, FRAMETIME_BYTE);
as_config(CONTROLREGISTER, PICTURE, PICTURE_BYTE);
  as_config(CONTROLREGISTER, MOVIE, MOVIE_BYTE);

bit_set(SHUTDOWNOPENSHORT_BYTE, 0);
bit_set(SHUTDOWNOPENSHORT_BYTE, 1);
as_config(CONTROLREGISTER, SHUTDOWNOPENSHORT, SHUTDOWNOPENSHORT_BYTE);  
}



I'll upload a video of this later so you can see the speed etc.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 25, 2012, 08:40 am
OK...here's the video. (Sorry about the crap quality  :smiley-red:)


http://www.youtube.com/watch?v=msn3LvtdRaM&feature=youtu.be (http://www.youtube.com/watch?v=msn3LvtdRaM&feature=youtu.be)
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Sep 25, 2012, 09:19 am
Its a nice video.
I do have a question . You look to have four resistors on your AS1130 board.  Are two of those the I2C pull-up resistors?  What are the other 2 for?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 25, 2012, 09:29 am
The resistors are:-
1 SDA pull-up
2 SCL pull-up
3 RSTN pull-up
4 IRQ pull-up


As per the datasheet.  ;)
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Sep 25, 2012, 03:42 pm
Oh, I was unaware you needed a pull up on each of them.
I'm going to be quite honest, I've never used interrupts.  Did you find yourself using them often in making sketches?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Sep 25, 2012, 04:38 pm
If you don't use pullups on those pins they'll be like the Grand Old Duke of York...they won't know whether they're up or down  :smiley-mr-green:

I use interrupts whenever I need them.

For instance (if I could get the IRQ line to respond  :smiley-eek:) I would play through 36 frames of data, then have the interrupt fire, then change the data and restart the movie with new frames.

I'm doing this at the moment but I have no control over when the change happens - if I used interrupts I would be in charge... ]:D
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 10, 2012, 08:44 pm
Fire away mate.... :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 10, 2012, 09:25 pm
To be honest mate...I think private messages are for 'private' communications.

If questions are answered on the Forum, then everybody benefits and mostly you get more than one answer which also benefits everybody. Also the recipient of a private message ends up answering the same questions over and over again.

Anyway...the bottom line is I don't answer private messages unless they are errrrr private... :smiley-mr-green:


To contradict the above... ]:D

I don't have a schematic for the board other than what is posted in this thread. The LEDs are wired exactly as shown in the datasheet and so is the AS1130. There is also quite a bit of example code posted in this thread.

The code for the video you refer to is written for the PIC18F4550 because I am more familiar with PICs and I have lots of them. I will port it to Arduino when I get the time but it's not a priority. Also I have hung on a 64K EEPROM which gives me room for 77 full pages of 36 frames.

I will be glad to answer any specific questions you have on the Forum and I suggest that you dive in and build yourself a panel, get the AS1130 and Arduino fired up and then see what problems you have.

Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 11, 2012, 07:16 am
The AS1130 will work fine with the ATmega128.  The only hurdle I see really is that I'm not sure if the Arduinos Wire library will work with it.  I don't see any reason why it wouldn't but at the same reason I don't know if it would, i'm not an expert on libraries.  The only thing that would really "kill" the 128 chip in terms of compatability is if it had TWI (I2C) or not, and it does, so you are golden there.  The 128 also has the same operating speed as an ATmega328P like on the popular arduino boards.  The thing is that the PIC18F4550 has a max clock speed of 48MHz, so it may run a little slower than the video(if there is one, i'm sick so I don't feel like looking) but it should still do fine.

I'm actually incorporating this chip into one of my projects and I plan on using an ATtiny85 clocked at 10MHz to run it, I think it'll do fine. Only 2 ways to find out and I don't wanna pull up the datasheet! (Lazy! cause i'm sick (that excuse works wonders))

Regarding the programming language, the microcontrollers are generally written in C code and then uploaded via an ICSP or some other type of programmer.

Regarding the frames, hexadec will have to answer that one.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 11, 2012, 10:46 am
Hope you feel better soon funky mate.... :smiley-roll-sweat:

Anyway....

The AS1130 runs completely independently once the microcontroller has told it what to do.

Basically, you set up the registers, upload the frame and PWM data and tell it to start...it then runs on it's own.

While it is running you can upload more data and it'll display that.

All this is explained in the first post of this thread along with the answer to all your other questions.... ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 11, 2012, 11:23 am
Read the sketch posted in the first post....and here http://arduino.cc/forum/index.php?topic=123071.0


BTW the speed of the processor is irrelevant it is only used as a master on the serial bus to send commands and data.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 11, 2012, 12:11 pm
Quote
I don't really understand every english expression


I'm not being rude but I think the basic problem is that this is not a chip to be playing with if you are a complete beginner.
If you need to ask questions like the ones you have asked (both in the PMs and in the Forum) then you need to start at a more basic level.

Questions like "what if I don't use an eeprom?" and "what language is used?" tell me that either:

a) you are a complete beginner
or
b) you can't be bothered reading the sample code or the data sheet.

I suggested to you that you build the system and use the supplied code to get the thing working....THEN ask questions about any problems you have (which I will be pleased to answer) or if you are really a beginner then try some simple matrix led experiments to give you a better understanding.

It took me many hours reading the datasheet of this chip to finally get a good understanding of it's functions...but I have a long background both in software and hardware and started off from a position of 'knowing' how to manipulate registers, write code etc.  ;) (also the English in the datasheet is not very accurate in some places!)


I'm not trying to put you off but just think that you are trying to run before you can walk (as we say in English  :smiley-mr-green:)
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 11, 2012, 04:29 pm
You will need a breakout board to be able to use the AS1130 if you don't already have a board.  The chip doesn't come in a DIP package, it comes in a SSOP-28 package so you won't be able to stick it in a breadboard when you get it.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 11, 2012, 08:22 pm
ALL your questions HAVE been answered you are just not understanding/listening/making any effort.

I see little point in continuing with this until you have a specific question about something you don't understand in the datasheet.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 11, 2012, 10:15 pm
He's kinda right.  What exactly do you not quite get yet, so we can help you out?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 12, 2012, 10:09 am
Quote
"The only hurdle I see really is that I'm not sure if the Arduinos Wire library will work with it."

Do you (or anybody else) know if there is another library I could use instead?


Code: [Select]
//Use Wire Library to do I2C communication  
#include <Wire.h>        


Code: [Select]
/***** Function to write commands and data to I2C bus ***************************/
uint8_t I2C_write(uint8_t command, uint8_t data)
{
 Wire.beginTransmission(AS1130ADDRESS);
 Wire.write(command);
 Wire.write(data);
 int ack = Wire.endTransmission();
   #ifdef DEBUG
     if (ack != 0)
     {
       Serial.print("Error: ");
       Serial.print(ack);
       Serial.print("\r\n");
     }
   #endif
 return ack;
}


Code: [Select]
 
/***** Start-up sequence as per datasheet - see Page 13 ******************************/
// (1) define ram configuration - see table 20 page 25
// (2) Fill the On/Off Frames with our data
// (3) Set-up Blink & PWM sets
// (4) Set-up Dot Correction (if required)
// (5) Define Control Registers - see table 13 page 20
// (6) Define Current Source (0 to 30mA) - see table 19 page 24
// (7) Define Display Options
// (8) Start Display (Picture or Movie) Movie takes precedence over Picture


The above answers every question you asked to start with and is all taken from my example code.  ;)

Quote
And if I use four AS1130 to build a 11x48 Matrix, how do I have to connect the Sync Pins?
1. I'll do it like in the datasheet, on p.32 Figure 27., that there is only one Sync-Pin configured as Sync_Out and the other three AS1130 are Sync_In and then the Sync_Out is connected to the three Sync_In? But that means that the clock speed will decrease?!
Therefore I have a 2. solution: To configure every Sync Pin of the four devices as Sync_Out that each of them works (with their own oscillator) independent from the others ?


You need to understand what the sync does.
How do you conclude that the clock speed will decrease?  :~
GOLDEN RULE: If it says it in the datasheet...it is 99.9999999% the way it's GOT to be done.

Quote
In the Datasheet is written: "After a first write of data to the frames, the configuration is locked in the AS1130 config register and can be changed only after a reset of the device. A change of the RAM configuration requires to re-write the frame datasets."


That is refering to the RAM configuration. You have to choose at setup time which configuration you want (1-6) For example you can have 36 frames and 1 PWM set or 18 frames and 4 PWM sets etc.
See Table 8 in the datasheet.

A soft reset can be performed using the Shutdown register...Table 23 but I have a reset button because I am developing software and want to ensure that all the data etc is cleared on restart.




Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 12, 2012, 11:27 am

thanks


for what?  :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 13, 2012, 10:18 am
Quote
I asked you some questions in my last post hexadec


That's right...you did. Trouble is (for you) that it isn't one of my life's priorities to answer your questions immediately...

Quote
So of what was funkyguy4000 talking there?


Don't know (and don't really care) why don't you ask HIM.

Quote
But would the circuit also work if I use four Sync_In Pins and let them work with their own oscillator that they are independant of the other devices clock?


You STILL haven't looked at what sync is/does...
If you want the chips to work independantly then don't use sync...if you want them synchronised then use sync. Not rocket science is it?



Now go away, learn some politenness and manners - then come back.




Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 13, 2012, 09:53 pm
I know this isn't strictly Arduino, but here's a video of where I'm up to and what's possible with this chip.

I'm now uploading the page data to the AS1130 through the MCU (could easily be an AVR  :smiley-mr-green:) from the PC.
The PC app takes data produced in a spreadsheet, converts it to binary format and uploads it to the external eeprom on the PIC board.
It then gets uploaded to the AS1130 as 36 frame pages. At the moment I'm using 10 x 36 frame pages (which will fit easily onto an AtMega328).

http://www.youtube.com/watch?v=JH9rZseoP2E

If anyone wants the source code for the PIC or the PC app. just ask.


I WILL be porting the code for the Arduino...but time is at a premium unfortunately  :(
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 14, 2012, 03:40 pm
Quote
I'm really sorry Hexadec


No problems mate...I was feeling a bit grumpy that day.  :smiley-mr-green:

It's best to think of the AS1130 as a completely separate entity which can receive data and instructions at 1Mhz over the I2C bus.

Once you have set up the AS1130 by sending instructions and the frame data and telling it to start, it will display the frames one by one at whatever rate you told it to.
It will do this forever without any more communication with whatever is sending instructions to it.

The fastest time between frames is 32.5mS  which is about 31 frames per second - the slowest is 487.5mS which is about 2 per second. (see Table 17 frame_delay)

While the AS1130 is displaying the frames you can upload another set of frames and it will display them. (It displays whatever is in it's eeprom 1 frame at a time)

Now think of the microcontroller as a seperate entity.

It can send instructions over I2C and stream data as fast as the receiver connected to it can process it.
It has eeprom memory that can hold binary arrays (in this case our frame data) until it is full.
It can communicate and exchange data with an external eeprom and send that data out over I2C. 

Now put them together...

MCU sends instructions and frame data to AS1130 and tells it to start.
AS1130 displays the frames on it's own and ignores the MCU.
MCU gets another 36 frames of data either from its own eeprom, an external eeprom, the serial bus or anywhere else that can be connected to it.
All this time the AS1130 is happily displaying the frames...
MCU sends new frame data to AS1130.

The cycle continues until the power goes down.  :smiley-mr-green:

Don't forget you can also send instructions to the AS1130 while its running as can be seen in the video.


The speed that the frames are displayed is constrained to one of 15 different speeds set in the Frame Time/Scroll register and has nothing to do with the clock speed the I2C bus speed or the MCU speed.

Hope that is now clear.... 8)

Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 14, 2012, 06:21 pm

@funkyguy4000 :

Of what were you talking there about that library?


I was speaking of the Wire library that Arduino uses.  I'm not sure if the ATmega128 that you are hoping to use will work with it,  my advice would just to try it out and see what happens.  I see no reason why it wouldn't work but also I wouldn't stand by that statement.  Just do some experimentation to see if it works.  If it does, could you kindly let us know?
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 15, 2012, 03:49 am
You'll have to go to the libraries folder of the arduino ide program and open it up in some sort of C programming environment
Title: Re: AS1130 First attempt - working
Post by: graynomad on Oct 15, 2012, 07:36 am
<your arduino insall folder>libraries\Wire


_____
Rob
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 15, 2012, 12:04 pm
Well spotted.... :smiley-mr-green:

When I was first looking at this chip I read somewhere that the sync line was open drain which I don't like to leave floating. (it isn't)

So, yes it's a mistake.  =(

As stated earlier in the thread, it doesn't matter if the sync is up, down or indifferent unless you are using it.  :)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 15, 2012, 12:29 pm
I don't think it will make any difference...I just have loads of electrolytics  :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 15, 2012, 01:18 pm
I haven't done anything yet with 2 screens, so I don't know.

I would guess that you should sync the two displays then use an interrupt to control the scroll time.

If I were you...I wouldn't complicate the issue by doing this yet...I would get a firm understanding of using ONE chip and ONE screen before you go further.  :D
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 16, 2012, 11:44 am
not stupid at all....

I just used cheap ordinary 2V, 20mA red.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 16, 2012, 07:57 pm
Nooooooo......all the VDD pins are connected internally...you just need ONE 10uF cap for each seperate AS1130.

The 4K7 on all pins should be fine.

Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 16, 2012, 09:53 pm
On the first board I made I connected all the VDDs and VSSs together...what a waste of time... :smiley-red:  :D

On the board I'm using for all the demos...pin 3 is connected to VDD and pin 1 to VSS, the cap is connected to both of them.

If you do a continuity test with a meter, you'll find the VDD pins are all connected together, as are the VSS.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 16, 2012, 09:58 pm
WAIT!
So you are saying I can choose which Gnd pin and which Vcc pin to use?  I don't need to connect all of them?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 16, 2012, 10:00 pm
Yep!  :smiley-yell: :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 16, 2012, 10:40 pm
AWWWWWW I wish I knew that earlier
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 17, 2012, 11:29 am
They won't be floating...they are connected internally. :P
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 17, 2012, 01:16 pm
Don't forget that the LEDs are being fed by a variable duty cycle.

I am using a 3.3V regulator fed from the 5V USB port (like on the Arduino) and the maximum current drawn by the AS1130 when all LEDS are on and at maximum brightness is about 245mA but this is only for a maximum 500mS as it then switches to the next frame.

I would allow 500mA per 11x12 panel..that should be more than enough (unless you have other stuff connected) 
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 17, 2012, 03:52 pm
Are you a student by any chance?  :smiley-mr-green:

Look up Ohms law and read the datasheet.

Read about PWM duty cycles.

]:D
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 17, 2012, 04:58 pm
:smiley-mr-green:
Quote
when the CURRENTSOURCE Register is 0xFF then every single led gets 30mA, so 132 x 30mA = 3,96mA no?


Ahhh but if you read the datasheet the LEDs are crossplexed and the scanning only turns on 1 Current Source at a time...

My board (as I said) draws 245mA when full on and it draws that for 487.5mS or a MAXIMUM of 500mS (it could be 32.5mS too but THAT would be the minimum time)

Quote
THIS problem with the current is the last thing I have to know to build the circuit finally...


You are right to consider all angles before embarking on a design and building the prototype....but the datasheet gives all this information and you can trust it!
OR
You can trust the fact that I have one working and I have shared the information.

If you consider that 11 x 20mA LEDs  draw 220mA when full on and you have 3 boards then 3 x 220 = 660mA
Then you must add some for the chips themselves plus leakage, losses, blah blah blah....

I would design for a 1.5A supply to drive 3 boards and a MCU etc.



Now it's time to get the soldering iron out.... :P
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 17, 2012, 06:31 pm
Quote
I'm really sorry that I'm still discussing with you

I don't have a problem with that...as long as you are prepared to put in the effort to understand.... :smiley-mr-green:

Quote
What do you mean with '1 Current Source'?

There are 12 Current Sources CS0 - CS11.

Try to forget about crossplexing and charlieplexing for a moment and think about how a matrix of LEDs is scanned.
Here is a good explanation of how it works: http://www.franksworkshop.com.au/Electronics/RGB/RGB.htm

This means that it is only possible for there to be 11 LEDs on at any one time. (in this case)
Then... we take into account that each LED is also PWM driven (you can look that one up yourself  :P)

Quote
But in your first programm the current source register is 0xFF so 30mA per Led, and then you have 330mA and not 235?


The current source register is not setting the amount of current drawn by each LED it is setting the maximum possible current that CAN be drawn (allowing dimming of the display)
The amount of current drawn is determined by the circuit characteristics but is LIMITED to a MAXIMUM of 30mA by the CS Register.

Quote
But if the Current Source Register is 0xFF then all the LEDs together draw 11x30mA so 330mA and that three times (three screens) so 990mA!

Wrong!

Quote
Isn't there any solution to have max. 500mA for the three screens together?

Yes.
The obvious way is to use LEDs that draw less current....if you can find them.
OR easier
Limit the current in the Current Source Register to 15mA (0x0F) but you'll have to make sure in software that this doesn't change.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 20, 2012, 05:17 pm
Like I said earlier...read the datasheet, use Ohms law and believe the datasheet (usually)  :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 21, 2012, 06:03 am
Quote
Okay as I understand the PWM is responsible for the brightness (if they shine bright or dark) and because of that the leds need more or less current.And if I want now to know the current of every single led then I use that formula on the page 33 'LED Current Calculation' ?
But if I only use that formula...then the fact that the other chips also need current is ignored?  cause you told this: "Then you must add some for the chips themselves plus leakage, losses, blah blah blah...."


Read the datasheets.  :smiley-roll-blue:

Quote
How can I be sure that the current of the LEDs is never too high that they burn? If I set the Current Source register the same value as the IMAX of the led?


Ohms Law...and why ask me to answer a question I have already answered in full?

Quote

I found some 10mA leds like these: (I want to use square leds, they look much cooler smiley-wink): http://www.eled.com/category.asp?catalog_name=leds&category_name=single+color+-+square+led&page=1
There is written IF=10mA, but if you open the datasheet there is written 20mA! So are those leds now 10mA or 20mA for IF?Could I use them?


Do you want me to email the supplier for you and ask them if their description or the datasheet is correct? :smiley-roll-blue:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 21, 2012, 06:46 am
So I don't believe this question has been asked.  Hexadec, would you happen to know how the programming would change if you were to have another chip in there?  Using the sync and everything?

Also they mention a adjustable clock out frequency,  would you happen to know anything about that?  Its on their table 25 on page 27 of the datasheet.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 21, 2012, 07:10 am
mornin' funky  :smiley-mr-green:(well it is here anyway)

As you know, for some reason I haven't yet discovered, I can't get any response on the IRQ line so I haven't done anything yet with multiple screens.

That said, you have several options for generating interrupts.

If, for instance, you want to scroll across 2 LED matrices I would think that you would set the first AS1130 (the one that generates the sync clock) to interrupt after the last frame. Then the controlling processor tells the next AS1130 to start scrolling. When it has displayed its last frame it sends an IRQ and the cycle repeats.

As for the programmable clock out freq., it's fairly clear that the sync frequency can be altered to 1 of 4 speeds but I have no idea if this changes the frequency of the internal clock of the 'master' chip as well as the sync out line. I'll do some research when I get a bit of free time.  :)
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 21, 2012, 07:25 pm
good morning! (afternoon now, it was a long night  ]:) )

Yea, I've been looking over the datasheet and I can't quite understand what they are trying to say with the clock speed dealio.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 21, 2012, 07:35 pm
Yeah...the whole datasheet is a bit difficult...there is no overview and the typical application diagrams are next to useless.

Oh well...at least it's been written by someone with a reasonably good command of English and it's not translated by Google from the original Thai dialect... :smiley-mr-green: :smiley-mr-green:

As soon as I get some time I'll be building a big board with 4 panels so the fun will REALLY start then.  :smiley-sweat:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 21, 2012, 07:36 pm
wait wait wait wait,  you have access to all that?  How much does that cost you?
(I've been looking for a cheaper way of fabrication but b/c I'm a student, I can't do much)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 21, 2012, 07:50 pm
It won't be costing me much (I hope) I've just bought a load of ultrabright red LEDs from ebay at just under $3 US per 100 so that's less than $16 then I'll use stripboard to mount them which I already have (bought from a charity shop for peanuts  ]:D ) The chips are donated by AMS, Microchip and Atmel and the adapter boards for the AS1130s are about $5 for 10 from China.

It's the large amount of soldering that puts me off... :smiley-mr-green:  
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 22, 2012, 01:34 am
Ohhh so you aren't fabricating your own custom boards at like a professional circuit board quality?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 22, 2012, 10:35 am
Noooo...much to expensive and it's more fun to get something working from a pile of old junk.  :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 22, 2012, 07:13 pm
True, it is super expensive.
I currently pay US $5 for a square inch for a 2 layer board
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 23, 2012, 06:02 am
Okay another question, more like a favor.

Could you comment your code a bit with reasons behind the code bits?
I don't quite get why you have frame addresses when you have them defined in a Frames array.
I don't understand this:

Code: [Select]
    //12x11 rectangle
  0b00000111, 0b11111111,    //CS0  Frame 0
  0b00000100, 0b00000001,    //CS1
  0b00000100, 0b00000001,    //CS2
  0b00000100, 0b00000001,    //CS3
  0b00000100, 0b00000001,    //CS4
  0b00000100, 0b00000001,    //CS5
  0b00000100, 0b00000001,    //CS6
  0b00000100, 0b00000001,    //CS7
  0b00000100, 0b00000001,    //CS8
  0b00000100, 0b00000001,    //CS9
  0b00000100, 0b00000001,    //CS10
  0b00000111, 0b11111111,    //CS11


And I also don't get why it seems like you do all your animations in the setup() method rather than the loop() method.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 23, 2012, 11:13 am
There's a few more comments in the code posted in this post: http://arduino.cc/forum/index.php/topic,123071.0.html

If I understand your question correctly (!?*) The code I posted is not supposed to show how do do tight efficient programming, it's laid out in what I hope is a logical and understandable way to show, step by step, how to get some action on a screen of LEDs using the AS1130.

Having said that, when I do the defines etc. I always have in mind how I intend to develop the code in the future.
Hard coding bits and settings in a programme is bad practice unless it is never going to change, but using variables defined elsewhere also adds some confusion to someone trying to learn how the process works.

Also...there is no way I would normally handle such a large amount of data as shown in the example. In my ongoing experiments with this chip (which have been with a USB enabled PIC18F4550 and a C# application on the PC) there is no data defined in the code, it is uploaded from a file and then fed to the AS1130 by the MCU. I have written the MCU code to respond to ascii characters sent over the USB from any source eg. the MCU receives 's' and then reads the status register of the AS1130 and sends it back to the terminal program on the PC... or it receives a 'u' which tells the AS1130 to go faster.

Here's the main loop:
Code: [Select]
while (TRUE)
{
usb_task();
if(usb_cdc_kbhit())
{
inByte = toupper(usb_cdc_getc());

if(inByte == 'A') {AS1130_decrease_brightness();}
if(inByte == 'B') {AS1130_increase_brightness();}
if(inByte == 'D') {AS1130_speedDown();}
if(inByte == 'F') {AS1130_fadeToggle();}
if(inByte == 'L') {AS1130_Scroll_left();}
if(inByte == 'M') {AS1130_scrollToggle();}
if(inByte == 'N') {flipData();}
if(inByte == 'P') {AS1130_Next_page();}
if(inByte == 'Q') {AS1130_Prev_page();}
if(inByte == 'R') {AS1130_Scroll_right();}
if(inByte == 'S') {AS1130_status();}
if(inByte == 'U') {AS1130_speedUp();}
if(inByte == 'Y') {write_new_EEPROM_Data();}
}
}


I am also sending the commands using a TV remote control...but THAT'S another story  :smiley-mr-green:

Anyway,

Code: [Select]
  //12x11 rectangle                                   <---this tells you what the code displays
 0b00000111, 0b11111111,    //CS0  Frame 0            <---these are the 2 data bytes for Current Segment 0 and this is the start of the first frame's data
 0b00000100, 0b00000001,    //CS1
 0b00000100, 0b00000001,    //CS2                     The 1's mean an LED is on the 0's off
 0b00000100, 0b00000001,    //CS3                     The data is arranged so that it is graphically meaningful ie. if you look at the frame datas' 1's you can actually see a 12x11 rectangle (on its side)
 0b00000100, 0b00000001,    //CS4
 0b00000100, 0b00000001,    //CS5                     The data is in binary format and follows the convention that the rightmost bit of the 2 bytes is LED 0 and bit 2 of the first byte is the LED 0A
 0b00000100, 0b00000001,    //CS6                     (see  datasheet  Table 9 page 15)
 0b00000100, 0b00000001,    //CS7
 0b00000100, 0b00000001,    //CS8                     The 3 MSB of the first byte tell the AS1130 which PWM set to use (0-7)
 0b00000100, 0b00000001,    //CS9
 0b00000100, 0b00000001,    //CS10
 0b00000111, 0b11111111,    //CS11                   <---these are the 2 data bytes for Current Segment 11 and this is the end of the first frame's data




The reason that everything is done in the setup is that it reads more sequencially and also to fire up the AS1130 initially it needs some data and all it's commands.
You need to think of the AS1130 as a seperate entity that does as it's told and the MCU as the boss chip that gives the orders.

Once the AS1130 has it's orders, it gets on with it with no more intervention from the MCU.

So... the main loop is where the programmer decides what to do next and the setup has already issued the correct instructions and data to get the ball rolling.

In short, the example programme is to give you ideas and inspiration (I hope) but is not a programming tutorial...that bit is up to the user... 8)


Hope that's a bit clearer now mate.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 23, 2012, 07:02 pm
Sorry I forgot to mention i'd figured it out this morning. 
I understand that.  I would like to do things with PWM.  If you figure any of that out, maybe we can write a library together or somethin
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 23, 2012, 07:11 pm
:smiley-mr-green: :smiley-mr-green:

I think I'll leave the library writing to you...I've got too many projects I want to get on with. (I'm programming a RTCC with an MCP79512 and a PIC18F26K20 at the moment)
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 23, 2012, 07:32 pm
Alright.

I'll continually update this thread with any progress I make
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 23, 2012, 07:55 pm
Great stuff!
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 23, 2012, 08:56 pm
Interesting.

In your code, it shows #define DOTCORRECTION 0x80
although in the datasheet it says
Quote
The Dot Correction Register is selected via data 128 on addr 253

the 0x80 is the data 128, but where is the address 253?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 23, 2012, 10:10 pm
Page 14 Table 7

0xFD  :P
Title: Re: AS1130 First attempt - working
Post by: J_ornothing on Oct 29, 2012, 12:20 pm
thanks to Hexadec for his/her clarifying comments.... I couldn´t figure out that all VDD and GND pins were internally connected.... and that saved me a lot of routing work... ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 29, 2012, 12:41 pm
I'm pleased to have helped.  :)

I'm a he...(hee hee) so thank-you Sir or Madam... ]:D
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 29, 2012, 04:23 pm
Oh wow, they created an account just to post that comment.
I haven't made any progress with actually testing it because both my soldering irons blew up basically
Title: Re: AS1130 First attempt - working
Post by: J_ornothing on Oct 29, 2012, 04:40 pm
new account created not only to thank Hexadec but to keep on posting.... on my first go i will cascade two 1130s to run 216 single LEDs, together with a AS1108 to run a "home-made" 4-digit 7-digit LED display and a EEPROM.... i will post as soon as i get some results... for good or bad... ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 29, 2012, 05:17 pm
Quote
on my first go i will cascade two 1130s to run 216 single LEDs


That sounds like fun... :smiley-mr-green: I'm trying to motivate myself to make up 4 boards (528 LEDs) but all that soldering really puts me off!

How are you going to arrange the 216 LEDs? I can't for the life of me see how you can do it unless you intend to switch off some Current Segments but even then you end up with the wrong number of LEDs.

I've got 3 AS1108s as well but haven't got round to 'evaluating' them yet.

It'll be great to see your results.  ;)


Quote
Oh wow, they created an account just to post that comment.


Yeah...I KNEW there were people out there with good manners... :smiley-mr-green: :smiley-mr-green: :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: J_ornothing on Oct 29, 2012, 05:51 pm
hahaha.... you bet it is going to be great fun.... I never programmed a PIC before, but shouldn't be so difficult..  :)

already tried to activate this amount of LEDs using shift registers, but blinking was unacceptable....though it worked fine

so now i am cascading AS1130s as shown in datasheet page 1 and connect them to a Freescale MS9S08JM16 (sorry Arduino folks, next time).... and will use all of the current segments, but not all LEDs.... i will balance each segment so i have similar number of LEDs on each of them.....

hope it works!!!.... i am not willing to show characters but will use LED configuration as shown in FIG.26 page 31, dropping out some LEDs

will upload schematics as soon as i finish off some connections doubts regarding EEPROM
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 29, 2012, 05:53 pm
Wow I really wish I had my own place. I would love to solder all those leds although I can't do it in my building.  Silly apartments.  
If anybody does anything with PWM for the AS1130, lemme know! I'm still trying to figure it out when I'm not studying or chillen with the girl.  
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 29, 2012, 07:05 pm
Quote
will upload schematics

That'd be great..I'd love to see what you do with it.

Quote
If anybody does anything with PWM for the AS1130, lemme know!


I did a simple PWM demo in post #6 of this thread.
If you can get the frames working then PWM is really easy...just fill the eeprom with the PWM data for each frame (6 sets and 6 frames) then set the bits in the first data byte to the PWM set number for each frame and off you go...
If I get any time this week I'll put some code together to demo PWM with this chip.


I'm currently working on driving an 8x8 RGB display with the AS1130 using PWM to generate the colour mixes....should be fun... XD
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 29, 2012, 07:37 pm
That would be awesome!
Where do you find time for this stuff?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 29, 2012, 07:41 pm
I need to get a life.... :smiley-mr-green: :smiley-mr-green: :smiley-mr-green:

don't watch much TV...gave up booze and fags...etc.


Just realised I've got no common cathode rgb modules so I'll have to wait on that one. I'll do some PWM stuff on the 11x12 instead then.  :*  XD
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 29, 2012, 07:46 pm
Ah.
I am planning on using 5050 rgb leds so doing the testing on the 11x12 is exactly what I would need.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 29, 2012, 08:03 pm
Arrrrgggghhh MORE soldering....LOL  :smiley-mr-green: have fun with that.

OK I'll get started on some PWM stuff...are you using the Arduino or PIC to drive the AS1130?
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 29, 2012, 08:32 pm
I'll be using an arduino, but I can parse the necessary information I need from code for a pic
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 29, 2012, 08:55 pm
No probs Funky...I'm doing it for the Uno as we speak....nearly done... :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 29, 2012, 09:05 pm
Awesome!
I won't be able to test it out until tomorrow because I left my serial cable for my duemilanove at work (the printer isn't set up right so I had to use the cable -_-)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Oct 30, 2012, 10:18 am
OK!

Here is the PWM demo as promised:

http://www.youtube.com/watch?v=2LYZrHvw264&feature=youtu.be

Sorry about the crap quality but you get the idea.  XD


Here's the code:
Title: Re: AS1130 First attempt - working
Post by: J_ornothing on Oct 30, 2012, 03:52 pm
as mentioned before here it is my crazy project for AS1130 and AS1108.... i apologize for not drawing better... i will tidy schematics up as soon as i finish all the other chapters.... routing, soldering, plastic 3D moulding,  marketing, betatesting, etc.... it may take some time   :smiley-roll-sweat:

as this project may add a little confusion to your discussions (Hexadec & Funkyguy4000) please tell me if you want me to open a new thread

i think i may reuse some of the coding you all have shared in this thread and as soon as i get mine i will share it as well

Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Oct 30, 2012, 04:28 pm

(Hexadec & Funkyguy4000) please tell me if you want me to open a new thread


Lets just keep it all running in the same thread.  I can't wait to see that thing actually work.  (I actually followed your schematic)

As for the PWM demo, are we only allowed to use the PWM sets that are stored in the AS1130 or can we stream in PWM data?  I wanna control the frequency of "raindrops" based on a personal rain detector that can detect how hard it is raining.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 02, 2012, 01:40 pm
Quote
hello guys, hope you still know me


How could we forget you... :P

Hello mate.  :smiley-mr-green:



Simple maths is what you need...for 36 frames you need 2 bytes for each current segment so :

per frame:
___________________
12 current segments                      
2 bytes each                                    12*2 = 24
___________________

36 frames                                       36*24 = 864
___________________

PLUS you may need 1 PWM set
1 byte for each LED                                   = 132

Bytes needed for each frame set   = 864+132 = 996

For 3 devices                                  3*996 = 2988

therefore you need less than 3KB for each 36 frame set.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 02, 2012, 06:35 pm

three AS1130's i'm going to use to show a moving font on the 11x396 screen.


Hold up! you can't do an 11x396 matrix using 3 as1130's .  Each 1130 can drive 132 leds MAX.  your 11x396 would need 33 1130's to drive that kind of matrix buddy.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 04, 2012, 03:29 pm
To (almost) quote the great Bob Dylan...

"the answer my friend is blowing in the datasheet"


Have a good read.  :smiley-mr-green:


...and...I even gave you a link to an explanation of multiplexing...read THAT as well.



Now I don't mind answering questions for someone who makes the effort and has the abilities required for the task, but actually THINKING for someone, then answering the questions, then answering the same questions again is really starting to make me lose the will to live........
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 04, 2012, 04:55 pm
Please binary, just read the datasheet, look at the cross-plexing diagram and then think about how digital electronics works
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 04, 2012, 07:40 pm
The datasheet is not as bad as some...but it IS hard to understand because it assumes quite a high level of knowledge and understanding from the reader. (quite rightly  :smiley-mr-green:)

If you read up on how a screen/frame/matrix of LEDs is scanned...all will become clear. ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 04, 2012, 08:15 pm
Are you just trying to wind me up?


Read how I2C works (hint 7 or 8 bit addresses).


OR

A better idea...YOU use address 0x60 in YOUR code and then you'll KNOW why mine is as it is.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 04, 2012, 09:50 pm
This is the last time I'm going to do your thinking/research!  ;)

Read this:
http://www.arduino.cc/en/Reference/Wire

Specifically:

Code: [Select]
Note

There are both 7- and 8-bit versions of I2C addresses.
7 bits identify the device, and the eighth bit determines if it's being written to or read from.
The Wire library uses 7 bit addresses throughout.
If you have a datasheet or sample code that uses 8 bit address, you'll want to drop the low bit (i.e. shift the value one bit to the right), yielding an address between 0 and 127.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 05, 2012, 09:59 am
I've already got some code that may be useful to you. I wrote it for the CCS C compiler.

What chip are you going to use and which compiler?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 05, 2012, 12:27 pm
Oh well...I'm not familiar with either.

C is C though... :smiley-mr-green:

Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 05, 2012, 01:29 pm
The program is pretty much C if you take out the Arduino Library stuff ie. wire.write() is i2c_write() or i2cWrite() in many C compiler libraries.

BTW I would use and adapt the LAST set of code I posted... ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 05, 2012, 03:21 pm
yeah..it has better comments and is laid out better. also uses PWM (if you need it)

I have also put some subroutines at the end that you may find useful.  :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 05, 2012, 08:03 pm
@Funky

I've bitten the bullet...after seeing 500 LEDs for $14 inc shipping I've ordered 2 x 4" x 10" stripboards and I going for it... ]:D

I can join the stripboards to make 8" x 10" which is big enough for a 24 x 22 matrix of LEDs (528) plus the AS1130s.

Wish me luck with all that soldering..... =(
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 05, 2012, 08:32 pm
Awwww yeaaaa.
Dude, you have as much luck as I can give, but i'm not a leprechaun so it may not make a difference. 

Lemme know how it goes.  I really want to make a rain animation using these ICs and all that as my end goal
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 05, 2012, 09:17 pm
More good news... :smiley-mr-green: :smiley-mr-green:

I've finally had the time to hook up a logic analyser to the AS1130 and it seems that I have a problem when using the wire library to read the registers...I haven't yet figured out what it is...but over reading all the registers around the Interrupt Status Register actually gets to read it AND clear the interrupt bit....Yeeeeeeaaawwwww!

This is the final problem with this chip.... XD

Will keep you updated.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 05, 2012, 09:30 pm
So there may be an unknown internal connect?
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 06, 2012, 07:22 pm
Part of the idea of having defines is that it makes it easy to adapt code....so for each extra chip you just need to change the default address to the address set on the chip and change the datasets and it should work out of the box.

(not that I know what you intend to do!  :smiley-mr-green:)


If you read the notes in the example code (AND the datasheet)...the picture register setting is overidden by the movie reg. setting so unless you are using pictures it doesn't need to be there...

...however it IS there to show how it can be used.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 06, 2012, 08:01 pm
Yo binarygod. Not that I don't like questions but you do know that you can start programming and if its wrong, you can change it. We've already discussed the hardware portion of the AS1130 and that's the part you can't change. 

Programming on your own may answer some of these question.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 06, 2012, 08:24 pm

So there may be an unknown internal connect?


I don't know what's going on yet...not had much time to play but I found that if I read 20 bytes starting at 0x00 (picture reg.) it frees the IRQ pin which should clear with a read of 0x0E (it doesn't)

There's something dodgy going on with the way I'm reading the bus using wire...but it works fine for the first 15 bytes...f*!k knows what's going on but the good news is at least I now know that the IRQ works OK to some extent which frees up continuing with four screens.

I must say though that I may just use the MCU to control the whole lot and ignore the chip interrupts. It should be easy enough to get everything synchronised. (I hope  :D)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 06, 2012, 09:21 pm
Well like I said...it is C code but unfortunately I'm not familiar with your compiler...if it's ANSI C you shouldn't have too much trouble.

How well do you understand the registers in your processor?

It's fairly easy to write routines to implement I2C in C but I'm sure your compiler will have routines for this.  ;)



EDIT:

I'm going to make a suggestion which you may or may not like....

Why don't you buy yourself an Arduino board, then you'll have 1000's of expert programmers there to help not only with the hardware side but the C programming as well.
I bought a genuine UNO for £16 on eBay but I'm sure there are cheaper versions (not that I'd recommend a Chinese rip off) or it's very easy to build one yourself. You can even buy the chips with the bootloader installed.  ;)

Here we are...free cable and free postage.
http://www.ebay.co.uk/itm/Arduino-UNO-R3-V3-0-ATMEGA328-FREE-USB-CABLE-Dev-Module-Ideal-4-Robotics-Rev-3-/321017689679?pt=UK_Computing_Other_Computing_Networking&hash=item4abe25364f
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 07, 2012, 09:49 am
Well...I wish you good luck with that!

As this is the Arduino Forum I doubt you'll get much help with porting code.
If it was from another compiler to the Arduino platform you would get loads of help.
I have shown you some of the things that you can do with the AS1130 and will continue to write code for it until I get fed up or move on to another interesting project but you can't expect me or anyone else to try to help you with coding using a compiler/language/chip that has nothing to do with the Arduino. (not on this Forum anyway)

If I were you, I'd get an Arduino....problem solved.

Otherwise, I don't see that you can progress much further in this Forum and I'm not aware of any help forums for your compiler.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 08, 2012, 09:57 am
Update on the IRQ problem:

Still haven't managed to set the address pointer to the correct register using wire but 1 major issue is solved.

The Control register address words are not contiguous...they read from 0x00 to 0x0B skip 2 then start at 0x0E again. so reading 14 bytes does not read all the registers as in my code but only reads as far as the 2 unused registers 0x0C & 0x0D. This means the IRQ status is never read and hence the IRQ pin is never cleared!

Oh well...I'm always telling people to RTF datasheets...... :smiley-eek:

At least now I can get on with the 24 x 22 matrix when the parts arrive from China.  :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 08, 2012, 04:39 pm
Interesting,  I'll have read the datasheet (again!) to understand.

How long do you think it'll take for them to arrive?
Usually takes about 25 days for me
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 08, 2012, 04:46 pm
Have a look at Table 13 reg. addresses...I had noticed it before but it didn't sink in that there were 2 addresses missing.

The veroboards arrived today and I already have about 400 LEDs so I'll be making a start pretty soon... :smiley-mr-green:


BTW it usually takes between 10 and 28 days to the UK.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 09, 2012, 04:27 pm
The software shutdown is implemented by the LSb of the Shutdown open short register.
Hardware shutdown is implemented by the RSTN pin.

According to the datasheet all the RSTN lines are connected together for all chips.

Obviously, the Shutdown open short register is different for each chip...so you need to send 3 commands for 3 chips.  ;)

The decision you have to make is whether you want to seperately Hard reset each AS1130 or whether you want to do them all at once. In the first case you need 3 dedicated pins, in the second only 1.

Or

You can leave the RSTN pins clear of the MCU and just use a button (this is what I have done)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 09, 2012, 08:50 pm
You can hard reset all the chips by connecting the RSTN lines together and pulling them to GND.

You can do this either with the MCU or a button (or both)

___________________________________________________________________________________
There is no way of soft resetting all the chips using one command.

Each chip has it's own Shutdown register and you have to clear the shdn bit in each chip seperately.

___________________________________________________________________________________

There might be a way of resetting them all with software but I haven't tried it and the datasheet is not clear about it but you can get all the chips to respond on the same address which may mean that one write to the Shutdown reg. will do them all. You'll have to try it to find out.  :smiley-mr-green:


Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 09:43 am

Answer/Question on your first paragraph:

see attachment!
so if I connect the switch like in the attachment, I can to a hardware reset with the uC AND with the switch if I understood well?

_________________________________________________________________________________________________________

Correct!
Quote

Answer/Question on your second paragraph:

I think I missunderstood you! you meant with "to send 3 commands for 3 chips" that when I send data to the first driver I have to send first his adress and then all HIS registers (with his own Shutdown register) with THEIR specific bits, then when I send data to the second driver I have to send first his adress and then his registers  (with his own Shutdown register) etc?

_________________________________________________________________________________________________________

You don't HAVE to send all the data to each chip to reset it...you just need to write to the Shutdown register.
Quote

In the end I have three methods to reset them??? :
software with their own register, and hardware with a switch & with the uC?

Yep!
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 12:22 pm
I'll let you know about the IRQ when I have my 24x22 matrix finished, but you MUST clear the IRQ by reading the IRQ status register before you can use it AND after every interrupt generated.

I'm thinking that I'll use the MCU to do the timing...but I can't experiment until I've built the boards.  8)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 12:53 pm
No...if you're not using them you can leave them floating. :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 02:39 pm
You have to connect the RSTN lines to a pullup resistor and to the switch, so the RSTN lines are pulled up not floating.

It's exactly as your schematic but not connected to the MCU pin.
Title: Re: AS1130 First attempt - working
Post by: graynomad on Nov 10, 2012, 03:24 pm
That looks OK if you want to have a separate switch to reset the 1130s.

If you also want to reset them under program control you run the "separate Pin" wire to an output on the Arduino and pull that output LOW to reset the chips.

_____
Rob
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 03:29 pm
You got it.... :smiley-mr-green:




@Rob
Hello Mr Nomad! I don't know if you've read all this thread but I've sorted out the IRQ line problem. :smiley-red:  :.
Title: Re: AS1130 First attempt - working
Post by: graynomad on Nov 10, 2012, 03:42 pm
This is turning into a bigger thread than one of the famous "random number" ones :)

I don't remember what the IRQ problem was now but but good that you nailed it.

_____
Rob
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 04:03 pm
That's very true...but why connect them to a resistor if they are not being used?

The statemachine of the AS1130s at Power on pulls the IRQ line to GND so it's not really floating anyway. :P
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 04:05 pm
Just noticed...3830 reads.... :smiley-eek:

I wonder if anyone is actually using this chip apart from us 3.... :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 05:25 pm
That's what I've done with my first test module...all the pullups are there but the RSTN and IRQ are not used.




I bet they're all using our ideas but are too shy to post.... ]:D ]:D
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 10, 2012, 07:23 pm
It sure will... ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 11, 2012, 01:10 pm
URGENT probably for you guys anyway.  :smiley-mr-green:

I've just discovered that pin18 (VDD) is NOT connected to the other VDD pins.

All the others are connected together as are the GND pins (all of 'em)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 11, 2012, 05:23 pm
Okay

Please could you post here if you are interested in further developments with the AS1130 as I'm getting a bit frustrated with the Arduino method of development and debugging.

This is due to my lack of knowledge of the system, but I don't see any point in continuing with this if nobody is interested (I'll carry on but with a USB enabled PIC18F4550 happily on my own.)


Cheers.  ;)
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 11, 2012, 06:54 pm
I thought you were developing this on the PIC already.  Please continue it on your preferred platform.  I'll take care of porting it to the arduino.
Title: Re: AS1130 First attempt - working
Post by: graynomad on Nov 11, 2012, 09:29 pm
I'm interested for future reference but not currently using the chips so don't have a lot of input.

Quote
the Arduino method of development and debugging.

What is this, and why is a PIC different? Are you referring to the neat-looking PICkit gadgets?

______
Rob
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 11, 2012, 09:55 pm
:smiley-mr-green: No...I don't have any gadgets other than a PicKit3 programmer/debugger.

I'ts mostly because I don't have to stumble every time I want to change something using the MPLAB IDE. I know how it works and am familiar with it.

Also I can set break points and step through code, look at timing cycles etc. etc.

The main thing that got to me this afternoon was I couldn't figure a way of moving the data array into another file and including it in the path of the compiler. I want to get on with programming the chips...not learning to do something that I can do without effort in the CCS C or PIC18 environment and it has frustrated me for a while now that I have to scroll past 380 lines of data to get from the defines to the main loop every minute or so. I can't even move it to the end of the file because the compiler complains... :smiley-roll:

Now that I have 2 chips on the go I will have a data array which is double the size and I don't want to wear out my middle mouse button or waste more of my precious time scrolling up and down like an idiot.  :smiley-mr-green:

I will continue to learn the Arduino way...but at the moment I want to get on with my 24x11 LED matrix....
Title: Re: AS1130 First attempt - working
Post by: graynomad on Nov 11, 2012, 10:13 pm
Yeah, learning a new tool set is a real pain, you just want to get on with the job but keep falling over stuff because you aren't familiar with it.

The standard IDE is way too frustrating to use IMO. That said you can split your code into multiple tabs, I've not done so (because I don't use the IDE :)) but that should allow you to move all the crap at the top of the file. Try clicking on the small down arrow at the right of the tab area, that gives a menu with a "New tab" option. I assume you do that and move code across but as I said I haven't done it myself.

I feel your pain re the lack of proper debugging tools. I've been using LPCs for a while now and it's fantastic to have a real debugging environment. Maybe you should try the Visual Micro IDE, that's based on VS2008/10/12 and it's pretty nice. It does have debugging although I've only just downloaded it and haven't got it working yet.

http://www.visualmicro.com/ (http://www.visualmicro.com/)

______
Rob

Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 12, 2012, 06:57 pm
Thanks for the comments guys.  :D

I've managed to get the data into another file now, so I'll stick with it I think.

Aparently the compiler goes through the files and headers in alphabetical order...so you have to make sure defines and declarations are in the right place!

http://liudr.wordpress.com/2011/02/16/using-tabs-in-arduino-ide/

Oh well...still here for the duration.... ;)



PS the VS stuff looks useful.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 16, 2012, 01:02 pm
Update:

I haven't given up... :smiley-mr-green:

I now have a board with 2 AS1130s and a 24 x 11 Matrix up and running.
Still waiting for the rest of the LEDs from China.
Sync works fine.

Interrupts now work...I'm currently coding an example.

I'll post a video and the code as soon as I have it in good shape.  ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 20, 2012, 08:52 pm
Well...

Here's the video anyway...I've had so much trouble with the I2C on the Arduino, I've given up on it for the duration and written this for the PIC18F4550.  :smiley-eek-blue:

My other 500 LEDs arrived today so I'll be getting on with the soldering and finalising the 24 x 22 Matrix code on the PIC, then if I can get it reliably working I'll port it to the AVR.

http://www.youtube.com/watch?v=lSDxH89JL20&feature=youtu.be


Sorry it's the usual crappy quality but at least you get the idea.  :smiley-mr-green:

This is AS1130 #1 providing the clock for #2 and it works very well. IRQs are still a little strange but I've got a handle on it now I think. ]:)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 21, 2012, 11:03 am
..still working on the code but I'll email it to you as soon as it's ready.  ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 21, 2012, 11:44 am
Quote
Hello,

could you please edit your last post and call me binarygod? i don't want that anybody knows my real name...
by the way: how do you know my real name?



done


change your youtube name to something that doesn't include your real name if you want to remain incognito... :smiley-roll:  
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 21, 2012, 01:09 pm
Are you hiding for some reason?  :smiley-mr-green: :P
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 22, 2012, 09:36 pm
"AS1130.h" is an included file and not a library and I use it to get it out of my way.

Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 23, 2012, 02:45 pm
It's just a way of splitting a file into 2 parts so that I don't have to scroll past all the defines etc. while I'm programming.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 25, 2012, 06:07 pm
When you program in C, you create what are called "header" files.  They contain all the class definitions for the methods used. You generally split the class definition and the class implementation parts of the class.  Its just how it works.  You can have the class implementation in the class definition file but it gets annoying to have to scroll past all the definitions.

Sorry I've been absent lately, I've been working on an FPGA and I've slowly been realizing how much more awesome it is. 
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 25, 2012, 06:28 pm
All true and helpful....except  :smiley-eek-blue: you can't have classes in C...that's why they invented the OOP version C++  :P


Nice to see you back mate...what FPGA are you playing with?
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 25, 2012, 06:52 pm
Ah, well I'm learning c++ now in my defense! :D

I'm working with a Spartan 6 FPGA on the Nexys-3 board from diligent.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 25, 2012, 09:55 pm
Looks like anice bit of kit...did your Uni supply it or are you rich?  :smiley-mr-green: :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: graynomad on Nov 26, 2012, 09:46 am
Quote
but I still have to scroll past all the defines because I'm using Dev-C++.

Are you saying that it doesn't allow include files? Yikes, what sort of compiler is that?

______
Rob
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 26, 2012, 05:53 pm
@binarygod

Yikes, yea, you should put those in a separate file and just include it.  Just like how you do with the wire library. 

@Hexadec

I wish I was rich.  Then I could get touchscreen lcds all up in this uni.  No my uni has them.  My semester ends here soon so I think i'll just check on out over winter break.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 29, 2012, 06:27 pm
To be honest mate...if you insist on using your own compiler, then you are going to run into problems as I said earlier.

I don't know how long the Mods or Admin will allow the discussion of porting code to another system.... :smiley-eek:

Having said that...I would look up how YOUR compiler works with the I2C bus and concentrate on that. The Wire library is a wrapper for I2C and as such will just confuse you if you don't know the I2C protocol.

Here is some of my code for the CCS C compiler...I hope I don't get banned or repremanded for posting it here.

It may help because it looks like it is closer to your compiler....

Code: [Select]
/*****************************************************************************/
/*                      COMMUNICATIONS FUNCTIONS                             */
/*****************************************************************************/

/***** Function to write configuration settings to I2C bus *******************/
void AS1130_config(char AS_addr, char ram_reg, char command, char data)
{
i2c_start();
i2c_write(AS_addr);
i2c_write(REGISTERSELECTION);
  i2c_write(ram_reg);
i2c_stop();

i2c_start();
i2c_write(AS_addr);
  i2c_write(command);
i2c_write(data);
i2c_stop();
}
/*****************************************************************************/
/*                 EXT EEPROM COMMUNICATIONS FUNCTIONS                       */
/*****************************************************************************/

/***** Function to write data to external EEPROM *****************************/
//Standard I2C Protocol (see datasheet)
void write_ext_EEPROM(long int address, BYTE data)
{
   short int status;
   i2c_start();
   i2c_write(EEPROM_WRITE_ADDR);
   i2c_write(address>>8);
   i2c_write(address);
   i2c_write(data);
   i2c_stop();
   i2c_start();
   status=i2c_write(EEPROM_WRITE_ADDR);
   while(status==1)
   {
      i2c_start();
      status=i2c_write(EEPROM_WRITE_ADDR);
// delay_cycles(200);
   }
   i2c_stop();
}
/***** Function to read data from external EEPROM ****************************/
//Standard I2C Protocol (see datasheet)
BYTE read_ext_EEPROM(long int address)
{
   BYTE data;
   i2c_start();
   i2c_write(EEPROM_WRITE_ADDR);
   i2c_write(address>>8);
   i2c_write(address);
   i2c_start();
   i2c_write(EEPROM_READ_ADDR);
   data=i2c_read(0);
   i2c_stop();
   return(data);
}


Seriously, you need to understand the I2C protocol fully before Wire or bit banged (or anything in between) I2C will make any sense.

Here is a link to the EEprom's datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21754M.pdf
Sections 4, 5 and 6 are pretty revealing as is the I2C description in the AS1130 datasheet.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 29, 2012, 10:44 pm
This is a discussion that should be open for all.  The only issue I can see is that it is programmed on a PIC.  Anything other than that is needless problems.  Please develop in proper IDEs.  If you have problems with I2C, understanding it and all.  I can write something up if you like.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 30, 2012, 11:21 am
Quote
It's arduino code so there can nobody tell me I'm in the wrong topic

ROFLMAO  :smiley-mr-green: :smiley-mr-green:


I did post at the beginning somewhere that this is my first attempt at using the Arduino system and the AtMega chips....before I started this project I'd never heard of the Wire library... :P

I can read though...and have a background in electronics and computer science.  ]:D

The code is not optimised or elegant...I just posted it to show how I got the AS1130 working with an Arduino.

Anyway....

I now have the 24 x 11 version working and am starting this weekend to solder up the other 2 chips and 264 LEDs which will give me 24 x 22. My plan then is to look into optimising the code and porting it to the Arduino...then I'll look at RGB, but I haven't found any RGB LEDs that I can solder in a very tight matrix.... :(

Until the code is optimised and debugged I don't really want to share it because I am changing it all the time...and I haven't even started to include blinking and dot correction yet  :smiley-eek-blue:


To answer your question...the begin method initialises the I2C bus and sets the internal pullups on SDA and SCL. The beginTransmission method does exactly what it says.... :D


Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 30, 2012, 11:28 am
Just another thought Mr God of the Binaries...

If you look in the Arduino installation on your computer, you can find all the code for the libraries and follow what they do and how they work...

...the only problem is that they are written as C++ classes and you need to understand the basics of the Class system and how to create them.





Me....I'm working class and proud of it.... :smiley-mr-green: :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 30, 2012, 06:20 pm
- Idk
- Idk
- Yes
- that is just the serial baud rate between the arduino and the computer.  9600 is just a convention.  Its just your go to baud rate. The choice has no affect on the actual operation of the AS1130.

^^^^Please done forget to answer binaries questions^^^^

Once we seem to have no more questions ever coming up and have this AS1130 thing figured out completely, we'll start a new thread with concise descriptions and all that so that people can do it.  It'll still be a discussion thread but we'll try to boil it down to get all the fluff out.  We are at 15 pages and thats kind of a lot to read through when you aren't sure if you'll get your answer.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 30, 2012, 06:39 pm
I do believe that just means that it is capable of accepting a 1MHz transmission rate in "fast mode". 
What fast mode is, I don't quite know entirely.  It may be something that automatically switches over at a certain threshold in which no coding is needed.
If there is coding needed, It would be initiated in the Power-On sequence.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 30, 2012, 07:35 pm
- int ack = Wire.endTransmission();
- the loop function HAS to be there...I'm just using it to start the AS1130 then pausing for a bit, then resetting, then it loops. It doesn't HAVE to. I could have changed data sets during the pause. etc.
- I already told you where to look for the answer to this and the first question. Did you look?
- why didn't you read about it BEFORE you asked the question?


Why have you STILL not read about I2C?

Here are some links:
http://dsscircuits.com/articles/arduino-i2c-master-library.html
http://www.instructables.com/id/I2C-between-Arduinos/

There are 100's more.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Nov 30, 2012, 07:40 pm
Oh BTW the Arduino defaults to 100kb/s for I2C or you can set fast mode which is 400kb/s.

The AS1130 can work at 1Mb/s but you'll have to bit bang at that speed...or get a compiler that will do it automatically. eg CCS C allows:
Code: [Select]
#use I2C(master, scl=PIN_B0, sda=PIN_B1, fast=450000)

//sets the target speed to 450 KBSP

Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Nov 30, 2012, 10:29 pm
Ohhh okay, that makes wayyy more sense haha.
I love bit banging I2C.  SO AWESOME!  Haven't done it with the arduino platform yet though.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Dec 01, 2012, 06:42 am
What details do you need? We may be able to help out.
How about this.  Link me the resources you've read and post your questions too.
I'll look through the links and answer the questions as best I can.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 03, 2012, 05:11 pm
@binarygod

As far as I am concerned I posted some code which will run the AS1130 chip with 132 LEDs in the hope that other people would contribute their own efforts and we could all learn something.

This thread has turned into something completely different  :smiley-roll:

I don't have the time, inclination or skills to teach you C, C++ or any other kind of programming. The same goes for electronics.      

Most of the questions you have asked have been about basic programming or electronics not about my programme or the AS1130.

Many of your questions have already been answered in the software I spent ages commenting but you have either not bothered to read or don't understand because you lack the basic knowledge.

For instance:
Quote
so where do I have to put the as_config(CONTROLREGISTER, SHUTDOWNOPENSHORT, 0b00000011); without making loops all the time?


Just makes my blood boil....I have posted code that works well that is commented AND answers this question and there was also a discussion with funkyguy about why all the setting up was done in the setup function and not in the main loop...

This is even worse:
Quote
But where can I set those 400kb/s? Or are they automatically set?


I've posted links which would answer this question, but even if I couldn't be bothered...a simple "arduino fast mode" bunged into Google brings up millions of pages. You only need to look at the first 20.

I've already suggested that you do some basic experiments with an LED matrix before you get involved with a VERY, VERY complicated chip like the AS1130...you have ignored this and continue to ask questions that have already been answered or should not need to be asked in the context of this thread. Not knowing what the setup() and loop() functions are there for is not a good starting point if you want to programme an AS1130.

You don't have a clue about the Arduino IDE and as far as I can ascertain you don't own an Arduino of any kind.

I on the other hand do have an Arduino and know enough of the basics of programming it that I can get the AS1130 working all on my own...I did this by spending a long, long time reading the datasheet and using Google. There is a mountain of information on every aspect of the Arduino freely and easily available...all you have to do is read it. There are 1000's of knowledgeable people willing to answer any questions on any subject, all you have to do is ask.

You also don't appear to have a working AS1130, an LED matrix or a compiler that allows the inclusion of header files (I find that very hard to believe) and spend lots of your time wasting my time by asking questions you should already know the answer to, not responding to the answers and then asking more questions...I've already said in this thread what I think of this, I suggest you start at post 1 and read the whole thread again.

The bottom line is...AND I have said this before to you...get an AS1130 hooked up to an LED matrix, connect your driver MCU, programme it and come back and ask SPECIFIC questions about the AS1130 which I will gladly answer. If your MCU is an Arduino and you have problems I or someone else will try to help...but basic questions about setting up things like I2C DO NOT belong in this thread.
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Dec 04, 2012, 12:05 am
Im with Hexadec on this one.
You can't work on a program or anything electronic without actually DOING it.
Electronics is logical but if you are a beginner such as yourself, its a lot to grasp so you might as well experiment.  Things may work for some reason without you knowing it.

As for my contributions with the AS1130, I'm having a hard time finding a soldering iron that actually freaking works.  I spent $50 on two soldering irons from radioshack, one never heat up, and the other wasn't sealed properly so it scorched itself.  Hate radioshack so much. 

I'll update when I FINALLY get one mounted.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 04, 2012, 10:18 am
@ binarygod

Thank-you so much for your last post and for the apology.  ;)

I will spend as much time as I have trying to help you with your project and I have no wish to see you leave this thread at all.

I just hope that you understand why I posted my feelings above and why I was a bit annoyed.

Please feel that you can contribute to the thread as well when you get your matrix working...we don't want to be "liberated" from you at all!  :smiley-mr-green:

Now go on....ask me a question......I dare you..... ]:D ]:D

Take care mate, Roy
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 04, 2012, 11:34 am
As soon as you have the hardware set up we can work through it and get your project working. I'm sure funky will be up for that as well.  :smiley-mr-green:

Spend whatever time you have on enjoying learning the basics and worry about the AS1130 when you have one.... ;)
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 04, 2012, 11:36 am
Quote
I spent $50 on two soldering irons from radioshack


Madness...pure madness... :smiley-mr-green: :smiley-mr-green: :smiley-mr-green:
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 04, 2012, 05:30 pm
You are quite welcome to the Arduino code which will scroll a message across a 24 x 11 matrix using movie mode...

...BUT...

a) it is not well commented.
b) it is split into 4 files
c) I have no time to explain how it works
d) I am in the process of changing it on a daily basis.

If you want it on the basis that you are entirely on your own with it and will get very little help from me then I will email it to you.  ;)

Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 04, 2012, 07:17 pm
It's changed quite a bit but the principles are still the same.

PM me your email address and I'll zip it and send it.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 04, 2012, 07:25 pm
Email sent...

In answer to your question in your PM I refer you to the following....

Quote
You are quite welcome to the Arduino code which will scroll a message across a 24 x 11 matrix using movie mode...

...BUT...

a) it is not well commented.
b) it is split into 4 files
c) I have no time to explain how it works
d) I am in the process of changing it on a daily basis.

If you want it on the basis that you are entirely on your own with it and will get very little help from me then I will email it to you.


Sorry.  :.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 04, 2012, 08:46 pm
@binarygod

I don't know what you don't understand about "you are entirely on your own with it and will get very little help from me" but you bombarding me with PMs and emails asking questions about the code is the very reason I did not want to share it in the first place!

[font=Verdana]I WILL NOT answer PMs about the code in any shape or form.[/font]

[font=Verdana]I WILL NOT answer emails about the code in any shape or form.[/font]

[font=Verdana]I MAY answer Forum posts about the code if I have the time which is VERY unlikely[/font]

If that is not now clear I will give up entirely and you will never get any code from me in the future.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 05, 2012, 10:39 am
You agreed that if I sent you the code you would not ask questions about it.

So...why did you send the PMs and emails asking questions?

If I share any more code here...it will be when I want to so don't bother asking again.

If you don't understand the code then go and learn somewhere else.

I give up.



@ Mods/Admin

Feel free to delete this thread as most of it is useless. I will post again when I have something to contribute.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 05, 2012, 02:05 pm
You're very welcome.

Now go and find a hobby that you are capable of....
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Dec 05, 2012, 02:51 pm
Hold up, I'm gonna start a thread marking the useful aspects later, like in about 5 hours.  So don't quite delete it yet. 
Title: Re: AS1130 First attempt - working
Post by: funkyguy4000 on Dec 06, 2012, 03:19 am
Okay here is the new thread.
http://arduino.cc/forum/index.php/topic,135865.0.html (http://arduino.cc/forum/index.php/topic,135865.0.html)

Hexadec, if you could please lock this topic or call moderator attention, that would be great.  we don't want two threads going for the same thing.  If it happens that the new one turns into a junky one like this, we'll just make another new one after a while.
Title: Re: AS1130 First attempt - working
Post by: macegr on Dec 06, 2012, 03:30 am
There is no hidden secret or trick to writing successful code from scratch. It is all hard work and research. You don't learn how to build a house by walking up to a construction crew, saying "Hey, I'm building a house too!" and asking them how to hold a hammer while they're working, and you don't own a hammer.
Title: Re: AS1130 First attempt - working
Post by: Hexadec on Dec 06, 2012, 11:14 am

There is no hidden secret or trick to writing successful code from scratch. It is all hard work and research. You don't learn how to build a house by walking up to a construction crew, saying "Hey, I'm building a house too!" and asking them how to hold a hammer while they're working, and you don't own a hammer.



I wish I could have put it like that instead of waffling.... :smiley-mr-green:

Thanks for your understanding friend.