Pages: 1 ... 8 9 [10] 11 12   Go Down
Author Topic: AS1130 First attempt - working  (Read 20007 times)
0 Members and 1 Guest are viewing this topic.
Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

..still working on the code but I'll email it to you as soon as it's ready.  smiley-wink
« Last Edit: November 21, 2012, 05:44:06 am by Hexadec » Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  
« Last Edit: November 21, 2012, 05:53:01 am by Hexadec » Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you hiding for some reason?  smiley-mr-green smiley-razz
Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"AS1130.h" is an included file and not a library and I use it to get it out of my way.

Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Sponge.
I'm allowed to have it 'cos it's not sharp.

Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1001
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Accelerate to 88 miles per hour.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All true and helpful....except  smiley-eek-blue you can't have classes in C...that's why they invented the OOP version C++  smiley-razz


Nice to see you back mate...what FPGA are you playing with?
Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1001
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah, well I'm learning c++ now in my defense! smiley-grin

I'm working with a Spartan 6 FPGA on the Nexys-3 board from diligent.
Logged

Accelerate to 88 miles per hour.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like anice bit of kit...did your Uni supply it or are you rich?  smiley-mr-green smiley-mr-green
Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8494
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1001
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Accelerate to 88 miles per hour.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
/*****************************************************************************/
/*                      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.
Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1001
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Accelerate to 88 miles per hour.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

I can read though...and have a background in electronics and computer science.  smiley-twist

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

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


Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

Southport UK
Offline Offline
Full Member
***
Karma: 1
Posts: 195
Been at it a long time...still learning every day.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Sponge.
I'm allowed to have it 'cos it's not sharp.

Pages: 1 ... 8 9 [10] 11 12   Go Up
Jump to: