AS1130 First attempt - working

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.

All true and helpful....except :fearful: 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?

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.

Looks like anice bit of kit...did your Uni supply it or are you rich? :grin: :grin:

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?



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


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.

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.... :astonished:

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....

/*                      COMMUNICATIONS FUNCTIONS                             */

/***** Function to write configuration settings to I2C bus *******************/
void AS1130_config(char AS_addr, char ram_reg, char command, char data)

/*                 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;
    //  delay_cycles(200);
/***** Function to read data from external EEPROM ****************************/
//Standard I2C Protocol (see datasheet)
BYTE read_ext_EEPROM(long int address)
   BYTE 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: Sections 4, 5 and 6 are pretty revealing as is the I2C description in the AS1130 datasheet.

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.

It's arduino code so there can nobody tell me I'm in the wrong topic

ROFLMAO :grin: :grin:

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.


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 :fearful:

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

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.... :grin: :grin:

  • 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.

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.

  • 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:

There are 100's more.

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:

#use I2C(master, scl=PIN_B0, sda=PIN_B1, fast=450000)

//sets the target speed to 450 KBSP

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.

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.


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 :roll_eyes:

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:

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:

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 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.

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.

@ 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! :grin:

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

Take care mate, Roy

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. :grin:

Spend whatever time you have on enjoying learning the basics and worry about the AS1130 when you have one.... ;)