Show Posts
Pages: [1] 2
1  Using Arduino / LEDs and Multiplexing / How to use PORTD,PORTB in Arduino ADK Mega on: November 06, 2012, 07:53:51 am
 Hello everybody
Code:
// Example 43.1
// tronixstuff.wordpress.com/tutorials > chapter 43
// John Boxall - October 2011
// Digital 0~7 set to outputs, then on/off using port manipulation
//http://tronixstuff.wordpress.com/2011/10/22/tutorial-arduino-port-manipulation/
void setup()
{
  DDRD = B11111111; // set PORTD (digital 7~0) to outputs
}

void loop()
{
  PORTD = B11110000; // digital 4~7 HIGH, digital 3~0 LOW
  delay(1000);
  PORTD = B00001111; // digital 4~7 LOW, digital 3~0 HIGH
  delay(1000);
}

This code run good with Arduino ATMega32 ,but can not run with Arduino ADK Mega
I don't know why ?
Can you help me ?
Thanks.
2  Using Arduino / LEDs and Multiplexing / Re: Maximum 2 dim array of ATMega32 ? on: November 04, 2012, 06:04:32 pm
 Hey ,i don't think send data to Rom and get back is the best way.
 Because the led matrix will be linking when run time with too delayed times.
Ussually , send to Rom only use for get Font.
With your way , the value of array is fix ,can not change  smiley-sad-blue
I think if you send to Rom and get back , you can use the easier way :
http://arduino.cc/en/Reference/EEPROMRead
http://arduino.cc/en/Reference/EEPROMWrite
3  Using Arduino / LEDs and Multiplexing / Re: Maximum 2 dim array of ATMega32 ? on: November 03, 2012, 04:32:46 am
Yeah.
Thanks for reply of Guix.

  I want to use array[16][128] by RAM to create effect for led matrix ,if you send to ROM and call back ,i think it will be delayed .  Value of
Code:
(dot[x][y])
is dynamic and not fix with one value.
  With solution send array to ROM ,i think only suitable for get font from ROM.

 Do you have better way ?
Thanks.
4  Using Arduino / LEDs and Multiplexing / Maximum 2 dim array of ATMega32 ? on: November 02, 2012, 06:38:47 pm
 
Code:
byte dot1[8][64] = {0};
 byte color1[8][64] = {0};
void setup() {
  Serial.begin(9600);
 //use a nested for loop to initialize all the pins
//pinMatrix[3][2]==99;
  for(int i = 0; i < 8; i++){
   for(int j = 0; j < 64; j++){
    dot1[i][j]=i+j;
    color1[i][j]=i+j;
   }//close for i
  }//close for j
   dot1[7][63]=110;
    color1[7][63]=55;
 for(int i = 0; i < 8; i++){
   for(int j = 0; j < 64; j++){
    Serial.print(i, DEC);
    Serial.print(",");
    Serial.print(j, DEC);
    Serial.print(" ");
     Serial.println(dot1[i][j], DEC);
   }//close for i
  }//close for j
for(int i = 0; i < 8; i++){
   for(int j = 0; j < 64; j++){
    Serial.print(i, DEC);
    Serial.print(",");
    Serial.print(j, DEC);
    Serial.print(" ");
     Serial.println(color1[i][j], DEC);
   }//close for i
  }//close for j
} //close setup()


void loop() {
 } //close loop()

Hello everybody.
 Do you know maximum 2 dimensional  array of ATMega32 ?
 Because i test with byte dot[16][32] ,ATMega32 run good.
But with byte dot[16][128] Arduino still not error but ATMega32 can not run .
I want use array with [16][128] ,can you help me ?
Thanks.
5  Using Arduino / LEDs and Multiplexing / Re: 5x7 LED Matrix Issue on: October 28, 2012, 04:05:16 am
 Hey Guy.
Led 5x7 only for children  smiley-cool
6  Using Arduino / LEDs and Multiplexing / Re: Array in Structs for EEPROM on: October 26, 2012, 08:29:21 am
Hey Fungus.
 You are really crazy man and baby man.
 This is a part of Led Matrix 128x32.
 Boring.
7  Using Arduino / LEDs and Multiplexing / Re: Array in Structs for EEPROM on: October 26, 2012, 07:06:53 am
5 days passing + two crazy mans replied . smiley-roll
8  Using Arduino / LEDs and Multiplexing / Re: Array in Structs for EEPROM on: October 26, 2012, 03:49:22 am
 Passing 5 days ,noboby reply !!!!!!!!!! smiley-roll-sweat smiley-cry smiley-small
9  Using Arduino / LEDs and Multiplexing / Array in Structs for EEPROM on: October 24, 2012, 07:22:16 am
Code:
/*
 * Copy and paste this block of #include & #defines into your code to use
 * this technique.
 *
 * (Don't worry too much about reading the macros, read through the
 * examples below instead.)
 */
 
#include <avr/eeprom.h>
#define eeprom_read_to(dst_p, eeprom_field, dst_size) eeprom_read_block(dst_p, (void *)offsetof(__eeprom_data, eeprom_field), MIN(dst_size, sizeof((__eeprom_data*)0)->eeprom_field))
#define eeprom_read(dst, eeprom_field) eeprom_read_to(&dst, eeprom_field, sizeof(dst))
#define eeprom_write_from(src_p, eeprom_field, src_size) eeprom_write_block(src_p, (void *)offsetof(__eeprom_data, eeprom_field), MIN(src_size, sizeof((__eeprom_data*)0)->eeprom_field))
#define eeprom_write(src, eeprom_field) { typeof(src) x = src; eeprom_write_from(&x, eeprom_field, sizeof(x)); }
#define MIN(x,y) ( x > y ? y : x )
 
const int buflen = 32;
 
/*
 * __eeprom_data is the magic name that maps all of the data we are
 * storing in our EEPROM
 */
struct __eeprom_data {
  int first;
  int second;
  boolean third;
  char fourth[buflen];
  char fifth[buflen];
};
 
 
void setup()
{
   Serial.begin(57600);
 
   /*
    * Writing simple variables to the EEPROM becomes simple
    *
    * First argument is the value to write, second argument is which field
    * (in __eeprom_data) to write to.
    */
   int q = 132;
   eeprom_write(q, first);
   eeprom_write(5958, second);
   eeprom_write(false, third);
   eeprom_write("Hello from EEPROM!", fourth);
 
   /*
    * You can even write from a pointer address if need be
    *
    * First argument is the pointer to write from.
    * Second argument is the field (in __eeprom_data)
    * to write to.
    * Third argument is the buffer length
    */
    const char * buf = "Another hello looks like this";
    eeprom_write_from(buf, fifth, strlen(buf)+1);
 
 
    int a, b;
    boolean c;
    char d[buflen], e[buflen];
    char *e_p = e;
    
    /*
     * Reading back is just as simple. First argument is the variable to read
     * back to, the second argument is the field (in __eeprom_data) to read
     * from.
     */
    eeprom_read(a, first);
    eeprom_read(b, second);
    eeprom_read(c, third);
    eeprom_read(d, fourth);
    
    /*
     * You can read back to a pointer address, if you need to.
     */
    eeprom_read_to(e_p, fifth, buflen);
    
 
    Serial.println(a);
    Serial.println(b);
    Serial.println(c ? "TRUE" : "FALSE");
    Serial.println(d);
    Serial.println(e_p);
    
    /*
     * The eeprom_write macros do bounds checking,
     * so you can't overrun a buffer.
     *
     * In __eeprom_data, 'third' is a one-byte boolean, but
     * eeprom_write knows this so only the first char 'T' is written
     * to EEPROM
     */
    eeprom_write("This is a buffer overflow", third);
    
    /*
     * If you have an array, like char[], you can write & read a single
     * array entry from a particular constant index
     *
     * Unfortunately, it only works for constant indexes not variables.
     * eeprom_write('X', fourth[x]) does not work with these macros.
     */
    eeprom_write('X', fourth[3]);
    eeprom_read(d, fourth);
    char x;
    eeprom_read(x, fourth[3]);
    Serial.println(d);
    Serial.println(x);
}
 
void loop() { }
Hello Everybody.
  Can you help me ,how to add string to EEPROM with struct , about ten arrays in a struct.
I search on Google , have a sample code ,but it 's only struct without array.
http://www.mediafire.com/?s07gbl47geq4df5
Can you help me
Thanks
10  Using Arduino / Programming Questions / Re: How to get Ascii of character or string ? on: October 07, 2012, 06:06:53 pm
Yeah. It's OK.
  Thankyou very much ,can you give me your email , nick Yahoo or Skype ? Because you make me very happy  smiley
 
11  Using Arduino / Programming Questions / Re: How to get Ascii of character or string ? on: October 07, 2012, 07:50:43 am
 Hi Tom
I just tested your code ,it's good but no display the first character of string.
Examle : char string[] = "abcd";
Result : 98 99 100
not display 97 of "a"
Can you modify ?
Thanks .
12  Using Arduino / Programming Questions / How to get Ascii of character or string ? on: October 05, 2012, 06:23:23 pm
 Hello everybody.

This is a code , char to Ascii
Code:
#include <stdio.h>
#include <conio.h>

main()
{
char c;
int a;
printf("Enter charater:",c);
scanf("%c",&c);

printf("%d",c);
getch();

}
Example :
Enter a character : a
 Result : 97

And this is a code ,string to several Ascii
Code:
#include <iostream.h>
#include <conio.h>
#include <string.h>
void main()
{
char *str1;
char st[80];
do
{
str1=st;
cin.get(st,80);
while(*str1)
cout<<int(*str1++)<<" ";
}
while(strcmp(st,"done")==0);

getch();
}

Example : Enter a string
  Hello abcd
Result : 72 101 108 111 32 97 98 99 100

These codes run good with Visual C++6.0 but not run in Arduino ,
can you help me modify them.

Thanks a lots.
13  Using Arduino / LEDs and Multiplexing / Re: Led matrix on: October 05, 2012, 07:05:01 am
Led 8x8 is very easy only for children smiley-sleep
14  Using Arduino / LEDs and Multiplexing / Re: How to get Font from EEPROM on: October 02, 2012, 07:42:42 am
 Yes, i hope you don't reply with not useful  smiley-mad

Thanks
15  Using Arduino / LEDs and Multiplexing / Re: How to get Font from EEPROM on: October 02, 2012, 07:37:04 am
I only want how to use this syntax
data = (byte) pgm_read_byte (&myfont[disp[line][c]][y])

not const prog_uint8_t PROGMEM BitMap[8] = {

Thanks             

Pages: [1] 2