Show Posts
Pages: 1 ... 13 14 [15] 16 17 18
211  Using Arduino / Project Guidance / Re: 7 segment doesn't work properly, no display, no counts! on: March 26, 2012, 12:22:02 am
Here I attach my schematic screen shoot...
Sorry if the size it too large, because I want to make sure the number is clear...
If you have Proteus Simulation, I can give you the soft file...anw it works in the simulation but not in the real circuit...

212  Using Arduino / Project Guidance / Re: 7 segment doesn't work properly, no display, no counts! on: March 25, 2012, 11:40:40 pm
I have tried to make pull down connection as instructed at the website,but still it doesn't work...
The led is blinking but the 7 segment even not on....
Anyone help me???? smiley-cry
213  Using Arduino / Project Guidance / 7 segment doesn't work properly, no display, no counts! on: March 22, 2012, 04:20:51 am
Here I attached you the picture of my project:


It doesn't show proper number as I programmed, maybe you think my code has little mistake but when I implement my code to the simulation using Proteus, it works very ok! So, I assume no mistake in the code.

I use two power supply for this project...
1st power supply for the arduino using usb cable
2nd power supply using ac to dc power supply for the shift register (74HC595)
And I wonder why I turn on and off and on and off repeatedly, the 7segment show weird number (not number exactly)
When I reach more than 4 V for the 2nd power supply, the 7 segment turned off...in fact the normal voltage 2-6V (from datasheet)

When the 7segment doesnt appear, I move my finger near the IC shift register, and the 7segment shows response by lighting dimly..
It is so weird.

Anyone can help me about this weird ?
214  Using Arduino / Project Guidance / Re: Why led be is dimmer in pin 2 than in pin 13 ? on: March 22, 2012, 04:10:44 am
Quote
@AWOL, thank a lot for your input but I need that type of that array in order to use "fromLine" parameters.
I don't understand the presence of the word "but" in that sentence.

Yeah, probably different type of mother tongue...

But I would like to say your code is much more simpler!  smiley-wink
215  Using Arduino / Project Guidance / Re: Why led be is dimmer in pin 2 than in pin 13 ? on: March 22, 2012, 04:04:30 am
@Grumpy_Mike: wow, you are right 101%! Now my led is so bright, genious, smiley-cool
216  Using Arduino / Project Guidance / Re: Why led be is dimmer in pin 2 than in pin 13 ? on: March 22, 2012, 04:03:11 am
@AWOL, thank a lot for your input but I need that type of that array in order to use "fromLine" parameters.

Code:
int PINCommLatch=MachineConfig[fromLine][0];
    int PINData=MachineConfig[fromLine][1];
    int PINClock=MachineConfig[fromLine][2];
217  Using Arduino / Project Guidance / Re: Why led be is dimmer in pin 2 than in pin 13 ? on: March 22, 2012, 03:43:55 am
http://s1075.photobucket.com/albums/w438/Sugianto_Thoeng/?action-view&current=arduino.jpg

this is what I attach, sorry about the post before...
218  Using Arduino / Project Guidance / Re: Why led be is dimmer in pin 2 than in pin 13 ? on: March 22, 2012, 03:40:40 am
Surely I dont use resistor for that two cases...

Here I attach, you see the led even like turned off...
Heuu, I found another problem, that my 7segment is hullaballo, dont work properly...



It is so weird, the 7 segment on when I move my finger near without touching the cable, what a mystic!
I dont have any sensor around there....
I move my finger to the shift register IC 74HC595, and the 7segment lights on randomly...
Can you help with this?
219  Using Arduino / Project Guidance / Re: Why led be is dimmer in pin 2 than in pin 13 ? on: March 22, 2012, 12:59:50 am
I dont put any code for pin 13, because I just directly connect the legs of the led to the pin 13 and ground, and then it lights so bright....
Then I compare with the led I connect to the pin 2 where I upload my code, and it is dimmer...

Hmm, well I'm sorry I'm doing my own experiment on the hardware without writing the code...

Yes I have tried as you said Bro, and it show brighter using pin 13 thatn pin 2...what's wrong here??? smiley-zipper
220  Using Arduino / Project Guidance / Re: Why led be is dimmer in pin 2 than in pin 13 ? on: March 22, 2012, 12:22:02 am
Yes sure, you are so good reply my question.

Code:
void setup();
void loop();
void increment (int line);
void show(int numberToDisplay,int fromLine);
void sendSerialData (byte registerCount,byte *pValueArray,int fromLine);
void sendSerialDatainitial(byte registerCount,byte *pValueArray,int fromLine);
int switchPin = A5;
int no1=1;
int no2=1;
int no3=1;


// Which pins are connected to which LED
const byte redLED0 = 2;
const byte redLED1 = 3;
const byte redLED2 = 4;

// Time periods of blinks in milliseconds (1000 to a second).
const unsigned long redLED0interval = 2000;
const unsigned long redLED1interval = 3000;
const unsigned long redLED2interval = 4000;

// Variable holding the timer value so far. One for each "Timer"
unsigned long redLED0timer;
unsigned long redLED1timer;
unsigned long redLED2timer;

// This pin gets sets low when I want the 595s to listen
const int  pinCommLatch1 = 5;
const int  pinCommLatch2 = 6;
const int  pinCommLatch3 = 7;

// This pin is used to pass the next bit
const int  pinData1    = 8;
const int  pinData2    = 9;
const int  pinData3    = 10;

// This pin is used by ShiftOut to toggle to say there's another bit to shift
const int  pinClock1     = 11;
const int  pinClock2     = 12;
const int  pinClock3     = 13;

// Definitions of the 7-bit values for displaying digits
byte g_digits [10];

//Machine Config in integer array
int MachineConfig[3][3];

// Current number being displayed
int g_numberToDisplay = 0;

// Number of shift registers in use
const int g_registers = 4;

// Array of numbers to pass to shift registers
byte g_registerArray [g_registers];

void setup()
{
  //config for line 1
  MachineConfig[0][0]=5;   //pinCommLatch line   1
  MachineConfig[0][1]=8;   //pinData line        1
  MachineConfig[0][2]=11;  //pinClock line       1
 
  //config for line 2
  MachineConfig[1][0]=6;   //pinCommLatch line   2
  MachineConfig[1][1]=9;   //pinData line        2
  MachineConfig[1][2]=12;  //pinClock line       2
 
  //config for line 3
  MachineConfig[2][0]=7;   //pinCommLatch line   3
  MachineConfig[2][1]=10;  //pinClock line       3
  MachineConfig[2][2]=13;  //pinData line        3
 
  // Setup the digits array
  g_digits [0] = 1 + 2 + 4 + 8 + 16 + 32 + 00;
  g_digits [1] = 0 + 2 + 4 + 0 + 00 + 00 + 00;
  g_digits [2] = 1 + 2 + 0 + 8 + 16 + 00 + 64;
  g_digits [3] = 1 + 2 + 4 + 8 + 00 + 00 + 64;         
  g_digits [4] = 0 + 2 + 4 + 0 + 00 + 32 + 64;             
  g_digits [5] = 1 + 0 + 4 + 8 + 00 + 32 + 64;         
  g_digits [6] = 1 + 0 + 4 + 8 + 16 + 32 + 64;
  g_digits [7] = 1 + 2 + 4 + 0 + 00 + 00 + 00;                   
  g_digits [8] = 1 + 2 + 4 + 8 + 16 + 32 + 64;
  g_digits [9] = 1 + 2 + 4 + 8 + 00 + 32 + 64;     
  //for loop 0-2 int
  for(int i=0;i<3;i++){
    sendSerialDatainitial(g_registers, g_registerArray,i);
  }
}

void sendSerialDatainitial(   
  byte registerCount,  // How many shift registers?
  byte *pValueArray,int fromLine)   // Array of bytes with LSByte in array [0]
{
    g_registerArray [3] = g_digits [0];
    g_registerArray [2] = g_digits [0];
    g_registerArray [1] = g_digits [0];
    g_registerArray [0] = g_digits [0];
   
    int PINCommLatch=MachineConfig[fromLine][0];
    int PINData=MachineConfig[fromLine][1];
    int PINClock=MachineConfig[fromLine][2];
     
    pinMode (PINCommLatch, OUTPUT);
    pinMode (PINData, OUTPUT); 
    pinMode (PINClock, OUTPUT);
   
  // Signal to the 595s to listen for data
  digitalWrite (PINCommLatch, LOW);
 
  for (byte reg = registerCount; reg > 0; reg--)
  {
    byte value = pValueArray [reg-1];

    for (byte bitMask = 128; bitMask > 0; bitMask >>= 1)
    {
      digitalWrite (PINClock, LOW);
   
      digitalWrite (PINData, value & bitMask ? HIGH : LOW);
       
      digitalWrite (PINClock, HIGH);
    }
  }
  // Signal to the 595s that I'm done sending
  digitalWrite (PINCommLatch, HIGH);
}  // sendSerialData


// Simple function to send serial data to one or more shift registers by iterating backwards through an array.
// Although g_registers exists, they may not all be being used, hence the input parameter.
void sendSerialData (
  byte registerCount,  // How many shift registers?
  byte *pValueArray, // Array of bytes with LSByte in array [0]
  int  fromLine)   
{
  int PINCommLatch=MachineConfig[fromLine][0];
  int PINData=MachineConfig[fromLine][1];
  int PINClock=MachineConfig[fromLine][2];
 
  // Signal to the 595s to listen for data
  digitalWrite (PINCommLatch, LOW);
 
  for (byte reg = registerCount; reg > 0; reg--)
  {
    byte value = pValueArray [reg - 1];

    for (byte bitMask = 128; bitMask > 0; bitMask >>= 1)
    {
      digitalWrite (PINClock, LOW);
   
      digitalWrite (PINData, value & bitMask ? HIGH : LOW);
       
      digitalWrite (PINClock, HIGH);
    }
  }
  // Signal to the 595s that I'm done sending
  digitalWrite (PINCommLatch, HIGH);
}  // sendSerialData


void loop()

  if (digitalRead(switchPin))
  {
    blinks();
  }
}

void blinks()
{
  // Handling the blink of one LED.
  if ( (millis () - redLED0timer) >= redLED0interval)
     {
     digitalWrite (redLED0, HIGH);
     delay (1000);
     digitalWrite (redLED0, LOW);
     increment (0);
     redLED0timer = millis ();
     }
   
   if ( (millis () - redLED1timer) >= redLED1interval)
     {
     digitalWrite (redLED1, HIGH);
     digitalWrite (redLED1, LOW);
     increment (1);
     redLED1timer = millis ();
     }
     
   if ( (millis () - redLED2timer) >= redLED2interval)
     {
     digitalWrite (redLED2, HIGH);
     digitalWrite (redLED2, LOW);
     increment (2);
     redLED2timer = millis ();
     }
   
}
 /* int line1 = random (1,3);
  int line2 = random (1,4);
  int line3 = random (1,6);
   
  int k=0;
  if(line1==1)
  {
      digitalWrite(2, HIGH);   // set the LED on
      delay(300);
      digitalWrite(2, LOW); 
      increment(0);   
  }
 
  if(line2==1)
  {
      digitalWrite(3, HIGH);   // set the LED on
      delay(300);
      digitalWrite(3, LOW); 
      increment(1);   
  }
   
  if(line3==1)
  {
      digitalWrite(4, HIGH);   // set the LED on
      delay (200);
      digitalWrite(4, LOW);
      increment(2);   
  }   
}*/

void increment(int line)
{
  if(line==0)
  {
   g_numberToDisplay = no1;
   no1++;
   show(g_numberToDisplay,line);
  }else if(line==1)
  {
   g_numberToDisplay = no2;
   no2++;
   show(g_numberToDisplay,line);
  }
  else if(line==2)
  {
  g_numberToDisplay = no3;
  no3++;
  show(g_numberToDisplay,line);
  }
}
   
void show(int numberToDisplay,int fromLine)
{
  if (numberToDisplay < 10)
  {
    //g_registerArray [4] = g_digits [0];
    g_registerArray [3] = g_digits [0];
    g_registerArray [2] = g_digits [0];
    g_registerArray [1] = g_digits [0];
    g_registerArray [0] = g_digits [numberToDisplay];
  }
  else if (numberToDisplay < 100)
  {
    //g_registerArray [4] = g_digits [0];
    g_registerArray [3] = g_digits [0];
    g_registerArray [2] = g_digits [0];
    g_registerArray [1] = g_digits [numberToDisplay / 10];
    g_registerArray [0] = g_digits [numberToDisplay % 10];
  }
  else if (numberToDisplay < 1000)
  {
    //g_registerArray [4] = g_digits [0];
    g_registerArray [3] = g_digits [0];
    g_registerArray [2] = g_digits [numberToDisplay / 100];
    g_registerArray [1] = g_digits [(numberToDisplay % 100) / 10];
    g_registerArray [0] = g_digits [numberToDisplay % 10];
  }
  else
  {
    //g_registerArray [4] = g_digits [0];
    g_registerArray [3] = g_digits [numberToDisplay / 1000];
    g_registerArray [2] = g_digits [(numberToDisplay % 1000) / 100];
    g_registerArray [1] = g_digits [(numberToDisplay % 100) / 10];
    g_registerArray [0] = g_digits [numberToDisplay % 10];
  }
 // else
  //{
    //g_registerArray [4] = g_digits [numberToDisplay / 10000];
    //g_registerArray [3] = g_digits [(numberToDisplay % 10000) / 1000];
    //g_registerArray [2] = g_digits [(numberToDisplay % 1000) / 100];
    //g_registerArray [1] = g_digits [(numberToDisplay % 100) / 10];
    //g_registerArray [0] = g_digits [numberToDisplay % 10];   
  //}
  sendSerialData (g_registers, g_registerArray, fromLine);
}
221  Using Arduino / Project Guidance / Why led be is dimmer in pin 2 than in pin 13 ? on: March 21, 2012, 11:53:49 pm
I am using Arduino Uno, I am doing my project and it use red led...
it is so bright when I connect it from pin 13
it is so dim when I connect it from pin 2
I meausre pin 13 and pin 2 has same voltage (5V) but pin 13 has much more high current...
Hmm, how to solve this? I want my led be bright at all pin...it really give me boundary,,,, smiley-confuse
Why it can happen? is it so or there is wrong with my arduino?

A lot of thanks.
222  Using Arduino / Project Guidance / Re: Simulate Arduino with Proteus on: March 15, 2012, 07:56:10 pm
Anyone knows how to add pin to Arduino Uno design in ISIS Proteus Simulator?
223  Using Arduino / Project Guidance / Re: Simulate Arduino with Proteus on: March 14, 2012, 04:25:06 am
Yes the bareboneduino is working very nice...
Now I'm simulating my project for the factory I'm working in...

But I need more pin for the Arduino Simulation...
The one I got is one for UNO which have less pin than Mega...
Anyone has the PROTEUS simulation for Arduino Mega?

Yeah, the IC microcontroller is the same ATMega 328, but I dont have any idea to add more pin...

Anyone could help me?
224  Using Arduino / Programming Questions / Re: How to counting up after 5000ms,7000ms,9000ms real time ? on: March 13, 2012, 11:43:27 pm
wooo hooo, your link really helps me!
A lot of thanks to Nick Gammon
225  Using Arduino / Programming Questions / How to counting up after 5000ms,7000ms,9000ms real time ? on: March 13, 2012, 10:15:10 pm
I am doing a project to display the target of production in one shift working...
I use Arduino UNO.
I have 3 lines of 7 segment as shown in the pictures...
The picture I attach is my simulation design in Proteus ISIS 7.9 SP1.


I am tasked to make
1st line counting up every after 5000ms,
2nd line counting up every after 7000ms,
3rd line counting up every after 9000ms,
Any idea how to do it without using delay 5000ms, then delay 2000ms, then delay 2000ms?
Because I think it is not effective since every line speed will not the same forever, the person in charge will change it according to the needs of the production cycle....

I hope you might understand what I'm trying to ask..Do not hesitate to ask smiley-grin
A lot of thanks.
Pages: 1 ... 13 14 [15] 16 17 18