Go Down

Topic: AS1130 First attempt - working (Read 21 times) previous topic - next topic

funkyguy4000

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?
Accelerate to 88 miles per hour.

Hexadec

#16
Sep 25, 2012, 07:32 am Last Edit: Sep 25, 2012, 07:37 am by Hexadec Reason: 1
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.
Sponge.
I'm allowed to have it 'cos it's not sharp.

Hexadec

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

funkyguy4000

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?
Accelerate to 88 miles per hour.

Hexadec

The resistors are:-
1 SDA pull-up
2 SCL pull-up
3 RSTN pull-up
4 IRQ pull-up


As per the datasheet.  ;)
Sponge.
I'm allowed to have it 'cos it's not sharp.

Go Up