Show Posts
Pages: 1 [2]
16  Using Arduino / Microcontrollers / measuring voltages on: July 04, 2012, 10:25:15 am
Hi all,
Wanting to simultaneously measure 26 different voltages, at various points on a circuit board (when the input voltages are supplied), using a test fixture, the results to be to be displayed on a computer monitor. Can anyone suggest a suitable microcontroller chip,  and possibly how best this task could be accomplished? I was thinking the atmega2560 in tandem with an atmega328P perhaps. Anything better?
Regards,
M.
17  Using Arduino / Displays / Re: arduino for vfd on: June 06, 2012, 12:56:18 pm
I tried this and these connections...still midnight.

Code:
void lcdCommand( unsigned char cmnd )
{
  LCD_DPRT = cmnd;        // ready data lines
  LCD_CPRT &= ~ (1<<LCD_RS);   // RS low (lower line on the timing diagram)to select the Instruction register.
  LCD_CPRT &= ~ (1<<LCD_RW);   // RW low to write instructions.
  delay_us(.020);              // Delay 20 ns for address set-up time.
  LCD_CPRT |= (1<<LCD_EN);     // Enable pin high to latch data on the falling edge.
  delay_us(.23);        // Enable pin high for 230 ns to enable latching of instruction set.
  LCD_CPRT &= ~ (1<<LCD_EN);   // LCD_EN pin of PortB low after sending an instruction.
  delay_us(.23);        // Enable pin low for 230 ns after sending instruction set.
}

//*******************************************************
void lcdData( unsigned char data )
{
  LCD_DPRT = data;
  LCD_CPRT |= (1<<LCD_RS);     // RS pin high (upper line on the timing diagram)to select the Data register.
  LCD_CPRT &= ~ (1<<LCD_RW);   // RW low to write instructions.
  delay_us(.020);              // Delay 20 ns for address set-up time.
  LCD_CPRT |= (1<<LCD_EN);     // Enable pin set to latch data on the falling edge.
  delay_us(.23);               // Enable pin high for 230 ns to enable latching of data set.
  LCD_CPRT &= ~ (1<<LCD_EN);   // LCD_EN pin of PortB low after sending data byte.
  delay_us(.23);        // Delay 230 ns between data sent.
}
Dave.
18  Using Arduino / Displays / Re: arduino for vfd on: June 05, 2012, 09:43:23 am
...I know you said don't post anymore pdf's but this is what I've been looking at for comparison.
19  Using Arduino / Displays / Re: arduino for vfd on: June 05, 2012, 09:35:23 am
Hello Don,
1)
Quote
Have you substituted an LCD for your VFD?
Don't have one; sent for 2 online yesterday 16x2 and 20x4, 5x7 dot matrix, arduino compatible.

2)
Quote
The timing diagrams for your VFD are very similar to those of LCDs in terms of the signal sequence but the times are significantly different.  At least one of the parameters specified on the VFD diagram does is not show up on the LCD diagrams.
I honestly don't see which one it is; I've compared each diagram and what I do see is that the LCD diagram gives the tEr and tEf (enable rise and fall times). I also see, as mentioned before, the tAS (address set up time) for the LCD is 40ns as compared to the 20ns, which I thought was the difference you were referring to.
Based strictly on the timing diagram for the vfd I have revised the two functions as follows, uploaded and nothing yet:

Code:
 
void lcdCommand( unsigned char cmnd )
{
  LCD_DPRT = cmnd;                    // ready data lines
  LCD_CPRT &= ~ (1<<LCD_RS);        // RS low (ref.quiz:lower line on the timing diagram)to select the Instruction register.
  LCD_CPRT &= ~ (1<<LCD_RW);      // RW low to write instructions.
  LCD_CPRT |= (1<<LCD_EN);          // Enable pin high to latch data on the falling edge.
  delay_us(.23);                          // Enable pin high for 230 ns to enable latching of instruction set.
  LCD_CPRT &= ~ (1<<LCD_EN);      // LCD_EN pin of PortB low after sending an instruction.
  delay_us(.23);                          // Delay 230 ns between instructions sent.
}

//*******************************************************
void lcdData( unsigned char data )
{
  LCD_DPRT = data;        // ready data lines
  LCD_CPRT |= (1<<LCD_RS);       // RS pin high (ref.quiz:upper line on the timing diagram)to select the Data register.
  LCD_CPRT &= ~ (1<<LCD_RW);  // RW low to write instructions.
  LCD_CPRT |= (1<<LCD_EN);      // Enable pin set to latch data on the falling edge.
  delay_us(.23);                        // Enable pin high for 230 ns to enable latching of data set.
  LCD_CPRT &= ~ (1<<LCD_EN);  // LCD_EN pin of PortB low after sending data byte.
  delay_us(.23);                     // Delay 230 ns between instructions sent.
}

3)
Quote
In any case your basic problem is that you still do not understand the relationship between whichever Timing Diagram you choose to follow and the code that you are attempting to use to implement that diagram.  Specifically, you do not understand how the delays in the program relate to the information on the Timing diagram.
You are correct; I do not understand how exactly to implement the timing diagram for the device in terms of the delays required in the program. That's the reason why I came onto this forum for help in understanding how this is done in general so that I may simply do it on my own for any device when given the specifications sheet and it's timing diagrams, in addition to learning as much as can be garnered about every other aspect of successfully interfacing any microcontroller to any peripheral. I was given this task to do for quite some time now, and have tons of code variations for it, first with the PIC18F458, and when that fell through because of outmoded connection issues,  now with the arduino uno.

4)
Quote
You must compare those comments to the Timing Diagram that I used, the one for the VFD, for them to make any sense.  After you do that you should be able to fix the errors that still exist and find out what is missing. 
If I'm not mistaken, what could be missing (and which would replace the second delay), is with reference to these links:
1) http://www.8051projects.net/lcd-interfacing/busyflag.php):

Quote
►BF - the Busy Flag

The Busy Flag is a status indicator flag for LCD. When we send a command or data to the LCD for processing, this flag is set (i.e BF =1) and as soon as the instruction is executed successfully this flag is cleared (BF = 0). This is helpful in producing and exact ammount of delay. for the LCD processing.

To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of the LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy and will not accept next command or data and BF = 0 means LCD is ready for the next command or data to process

2) http://www.8051projects.net/lcd-interfacing/busyflag.php:

Code:

#define F_CPU 16000000UL

#include <avr/io.h>   
#include <util/delay.h>

#define LCD_DPRT  PORTD      // configuring PortD for data
#define LCD_DDDR  DDRD
#define LCD_DPIN  PIND
#define LCD_CPRT  PORTB           // utilizing PortB pins for the control.
#define LCD_CDDR  DDRB
#define LCD_CPIN  PINB
#define LCD_RS  0             // control pin assignments.
#define LCD_RW  1
#define LCD_EN  2
#define      LCD_D7  3
//*******************************************************
void delay_us(unsigned int d)
{
  _delay_us(d);
}
//*******************************************************
void LCD_busy()
{
     DDRD = DDRD &= ~ (1<<LCD_D7); //Make D7th bit of LCD as input
     DDRB = DDRB |= (1<<LCD_EN);    //Make port pin as output
     LCD_CPRT &= ~ (1<<LCD_RS);    //Selected instruction register
     LCD_CPRT   |= (1<<LCD_RW);    //We are reading
     while(LCD_D7){                        //read busy flag again and again till it becomes 0
       LCD_CPRT &= ~ (1<<LCD_EN);  //Enable H->L
       LCD_CPRT |= (1<<LCD_EN);
     }
}
//*******************************************************
void lcdCommand( unsigned char cmnd )
{
  LCD_DPRT = cmnd;                // ready data lines
  LCD_CPRT &= ~ (1<<LCD_RS);    // RS low (lower line on the timing diagram)to select the Instruction register.
  LCD_CPRT &= ~ (1<<LCD_RW);   // RW low to write instructions.
  LCD_CPRT |= (1<<LCD_EN);      // Enable pin high to latch data on the falling edge.
  delay_us(.23);                       // Enable pin high for 230 ns to enable latching of instruction set.
  LCD_CPRT &= ~ (1<<LCD_EN);   // LCD_EN pin of PortB low after sending an instruction.
  LCD_busy();                            // Wait for LCD to process the instruction.
}

//*******************************************************
void lcdData( unsigned char data )
{
  LCD_DPRT = data;
  LCD_CPRT |= (1<<LCD_RS);      // RS pin high (upper line on the timing diagram)to select the Data register.
  LCD_CPRT &= ~ (1<<LCD_RW); // RW low to write instructions.
  LCD_CPRT |= (1<<LCD_EN);     // Enable pin set to latch data on the falling edge.
  delay_us(.23);                       // Enable pin high for 230 ns to enable latching of data set.
  LCD_CPRT &= ~ (1<<LCD_EN); // LCD_EN pin of PortB low after sending data byte.
  LCD_busy();                         // Wait for LCD to process the instruction.
}
This compiles but when uploaded, still nothing.
Dave.
20  Using Arduino / Displays / Re: arduino for vfd on: June 01, 2012, 03:05:33 pm
Quote
You have left out three comments and the two relating to the delays are quite important.  Take a look at those delays and compare them to the timing diagram.  Then take another look at the timing diagram and see which of the delays on that diagram is not being implemented.


    I looked at the timing diagram over and over again, plus researched extensively on how to implement the timing diagram in terms of the program delays.The timing diagrams for the LCD's I looked at are very similar in terms of the particular time intervals involved in signal generation, with difference occurring for the address set up time prior to enable going high. Came up with these 2 sites:     (http://www.datasheetcatalog.org/datasheets2/17/174436_1.pdf---pg.4) and (http://jjackson.eng.ua.edu/courses/ece480/lectures/LECT07.pdf---pg.7); settled on the latter in terms of the flow chart for the 1st delay.
    Having put that into the program and uploaded, still nothing. Here's the change.

CODE:
void lcdCommand( unsigned char cmnd )
{
  LCD_DPRT = cmnd;                           // Ready data lines for command signals   
  LCD_CPRT &= ~ (1<<LCD_RS);             // RS low to select the command register
  LCD_CPRT &= ~ (1<<LCD_RW);           // RW low to write commands.
  LCD_CPRT |= (1<<LCD_EN);               // Enable pin set to latch data on the falling edge.
  delay_us(41000);                         // Enable high for 41 ms for LCD module to run a command.         
  LCD_CPRT &= ~ (1<<LCD_EN);           // LCD_EN pin of PortB is cleared after sending a command.
  delay_us(100);                                // Delay 100us between commands sent.      
}

void lcdData( unsigned char data )
{
  LCD_DPRT = data;                  // Ready data lines for data.
  LCD_CPRT |= (1<<LCD_RS);            // RS pin set to select the Data register.   
  LCD_CPRT &= ~ (1<<LCD_RW);       // RW low to write commands.
  LCD_CPRT |= (1<<LCD_EN);           // Enable pin set to latch data on the falling edge.
  delay_us(100);                             // Delay 100us between data sets.             
  LCD_CPRT &= ~ (1<<LCD_EN);       // LCD_EN pin of PortB is cleared after sending data byte.
  delay_us(100);                             // Delay of 100us.   
}

/CODE

21  Using Arduino / Displays / Re: arduino for vfd on: May 29, 2012, 12:13:55 pm
Hello and Good morning sir,
I have 3 concerns.
1) I looked at the timing diagram and compared it to the lcdCommand routine. Data is sent on the high-to-low enable signal AND when the register select and RW signals are low. From a diagram I drew up based on the high-to-low enable signal duration, this appears every 660 (230x3)ns. Seems to be related to the time for an instruction  to be run as shown in the table of page 3 of the data sheet; so I'm putting the delay at 666ns between commands sent which is significantly smaller than that for an LCD as given in the text (100us).
2) Which brings me to the next concern. How IS the delay worked out from the timing diagrams, in general? I take it the first delay is for the enable pin signal duration and the second the delay between commands and for the display to run the command? For example where does the program in the text come up with 1us and 100us for the 1st and 2nd delays respectively?
3) How are the delays for the various routines obtained in general, like for LCD_data and the LCD_init; are they chosen as rounded figures relative to the times on the diagrams between successive highs and lows? How does the author come up with 2000ms in the LCD_init routine?
4) We placed the connecting ribbon with the CIODIO in another computer last week. I connected the unit directly to the arduino using jumpers and the wiring scheme which. What i noticed is that when i connected all the jumpers in order from digital pin12 to digital pin2 of the arduino to the corresponding pins on the display and uploaded the program, there wasn't a problem; when i then connected digital pin1 to pin 7 of the display and tried to upload, I get the error 'avrdude: stk500_getsync(): not in sync: resp=0x00' which is said to refer to a communication problem with the board; was wondering what could be causing this?
...and still nothing with these changes uploaded.
22  Using Arduino / Displays / Re: arduino for vfd on: May 25, 2012, 04:09:29 pm
Here's what I've come up with so far, based on what you posted last and looking at the vfd timing diagram. Am leaving early this evening, but would look at this again later on to hopefully get the first part done. Wont have the unit with me. Have a very pleasant Memorial Holiday and thanks thus far for putting up with me.
Regards,
Dave.
23  Using Arduino / Displays / Re: arduino for vfd on: May 25, 2012, 11:32:44 am
05-25fri-12
Good Morning Don,
   The code I'm working with (12.5.4)  is posted.
    I have been comparing the required timing for the vfd on pg 16 of it's datasheet, with that for the uno on the atmega datasheet, pg104 which deals with the timer counter and the output compare registers. Also using the simpler diagram in the textbook which compares the data signals with the signals on the en, r/w, r/s pins, just like for the vfd timing diagram.
    I've also sent a snippet of the first part of the code which worked with the CIODIO-48 board the first time around.
    I think there is correspondence with this in terms of the initiatialization sequence. It seems to me that the realization of the timing diagram in the vfd datasheet is obtained from the 'void SendDataToDisplay' subroutine; in particular the last part. Was looking at the way this same routine is supposedly realized in the Arduino code, in terms of the interactive timing of the signals on the en  r/w,r/s pins and when data is written. In fact I  really don't see any lines corresponding in the arduino code that would address the timing issue as is done in the CIODIO code, except the lcd_print (char*str) which I think is insufficient.
   I'm also keeping in mind my ultimate objective which is for the program to sense signals for various parameters (altitude, airspeed,airpressure,mach,...) and display any 3 on the first 3 rows of the display, with the 4th used to enter new information, which is automatically sent to row 1 with previous information 'stepping down' to rows 2 and 3, row 4 remaining void for new info.
   Pardon my sending this again. Posted a reply earlier and the system kept bouncing me back out with an end-of-time-session response. Attempted here again.
24  Using Arduino / Displays / arduino for vfd on: May 25, 2012, 11:11:18 am
05-25fri-12
Good Morning Don,
   The code I'm working with (12.5.4)  is posted.
    I have been comparing the required timing for the vfd on pg 16 of it's datasheet, with that for the uno on the atmega datasheet, pg104 which deals with the timer counter and the output compare registers. Also using the simpler diagram in the textbook which compares the data signals with the signals on the en, r/w, r/s pins, just like for the vfd timing diagram.
    I've also sent a snippet of the first part of the code which worked with the CIODIO-48 board the first time around.
    I think there is correspondence with this in terms of the initiatialization sequence. It seems to me that the realization of the timing diagram in the vfd datasheet is obtained from the 'void SendDataToDisplay' subroutine; in particular the last part. Was looking at the way this same routine is supposedly realized in the Arduino code, in terms of the interactive timing of the signals on the en  r/w,r/s pins and when data is written. In fact I  really don't see any lines corresponding in the arduino code that would address the timing issue as is done in the CIODIO code, except the lcd_print (char*str) which I think is insufficient.
   I'm also keeping in mind my ultimate objective which is for the program to sense signals for various parameters (altitude, airspeed,airpressure,mach,...) and display any 3 on the first 3 rows of the display, with the 4th used to enter new information, which is automatically sent to row 1 with previous information 'stepping down' to rows 2 and 3, row 4 remaining void for new info.
25  Using Arduino / Displays / Re: arduino for vfd on: May 23, 2012, 05:02:12 pm
Don,
The diagrams you presented were very clear on everything. Unfortunately, the vfd still does not respond after wiring it up exactly as illustrated.
I'm using only the programs with 8 bit mode programs, in particular the two entitled 'YES' and 'DON', 12.5.3 and 12.5.4 resp.
     I know you mentioned your non-use of voltage measurements, but when nothing came on, I checked the voltages on the pins on the connector at the back of the display. Noticed active high voltages when I had r/s and en from the display going to digpins 8 and 10, according to your earlier post for PortB pin positions, and the code for  #definitions for the 'YES' sketch. Now, all pins, (except vcc ofcourse) including r/s are active low with the new wiring scheme.
The super reinstalled the original CIODIO-48 back into the computer he used to run his program; even his program did not get it to work, although on disconnecting the vfd and checking the scope for the appropriate high/low signals for the write part of the instruction set, his program appears to be at fault, which does not yet rule out the unit; he’s working on that.
Have analyzed this last post you sent and changed the clock speed 16MHz for the desired delays.
   I’m trying to come up with a function to address the timing issue as far as sending data and commands, to work that into the code.
   Will let you know what I come up with. Apologize for not responding sooner.
Dave.
26  Using Arduino / Displays / Re: arduino for vfd on: May 22, 2012, 03:51:15 pm
I apologize if I overwhelmed with the amount of code; it was an error on my part.
27  Using Arduino / Displays / Re: arduino for vfd on: May 22, 2012, 02:47:54 pm
Hello Don,
  Thanks for your response. Based on the information you provided, I rewired the the uno from the ribbon connector to the uno, as you indicated, and changed the program to reflect those changes for a 2port 8pin mode connection uploaded and still nothing. (Just to be sure, I take it #define LCD_RS  0....LCD_EN  2 lines mean the control lines from the ribbon connector go to digPins 0,1 and 2 of PortB, right? That's how i have them.).
  Also did a careful comparison of the eg2.7, 4bitmode single port and eg 2.5 8bit mode double port, and reread the section for the various ways of displaying character data, and tried to do a 8bitmode single port sketch. Basically, I've just been experimenting with different variations of the code and comparing them with the requirements in the specs for the vfd for writing the info.
  Even requested from the super if he could pull up the source code to reconnect the CIODIO48 to check the display for functionality....
  In addition to the mountain of code i've written in MPLABv8.84 and the PIC18, plus C++ source code, here's what I've come up with and utilized thus far from Mr. Mazidi's and arduino's site, all of which compiles and the 'YES' one gives me everything nicely (unlike yesterday) as you pointed out, the enable pin active low, active highs (3.7volts and higher) on the data pins, and the other pins as should be.
28  Using Arduino / Displays / Re: arduino for vfd on: May 22, 2012, 04:47:34 am
Hi again,
Attempted to attach a number of files at the same time (missed the more attachments link). didnt see them as attached, except for the source code so sending them here.
29  Using Arduino / Displays / Re: arduino for vfd on: May 22, 2012, 04:33:32 am
Appreciate your response and honesty. Addressing the link you provided, I provide the following information. I have been on this apparently simple task at work for quite some time (since April 12th.), first trying to get a PIC18f458 to operate the display, and because of numerous connectivity and uploading problems, switched to the uno. Fairly new to embedded programming and using forums and the PIC and the arduino; so pardon my non-use of code tags last time around; had to look up what that was. Anyhow, for the program I uploaded , I used the portB 8bit single port sketch I derived from the egs, which compiles; all the sketches when modified, do. I'm getting:
 data pin 0 3.1mV
 data pin 1 has 4.9volts
 other data pins 4.06volts, (logic 1 for activation)
 the rs,en pins sit at 4.9volts,
 w/r pin at grd, and vss and vdd are at 0 and 5 volts resp......still nothing shows up on the display.  I take it digital pins 2->9 represent portB data pins? There seems to be some issue with dpins 0 and 1 unlike the other data pins; I take it these should be high for anything to occur. An interesting thing though; when i take the connector off the back of the display and check the voltages on the arduino they are in the significantly small:
 data pin (digpin9)= 0 3.1mV    data pin 1 (DP8)= 4.9volts   the other data pins are in the hundreds of mV range (less than 1V).

    I also uploaded this program to another uno and I got the same scenario, so this could imply that the code itself is generating this occurence on DPin 9.
    Additionally, this same vfd worked when using a borland C program with a CIODIO48 board (hence the ribbon) placed within a card slot working in conjunction with the CPU of a windows 98 OS which was shown to me sometime in November of last year, so I know it works.
    I'm not sure what next to consider doing to resolve this problem since I'm not quite sure what all the requirements may be in order for the display to respond; I think I've covered everything; can you assist me to get this vfd working? Appreciate.
M.



30  Using Arduino / Displays / arduino for vfd on: May 19, 2012, 05:49:05 pm
Hi,
Using now an Atmega 328P arduino uno to get the same noritake itron vfd CU20045-UW5A to work . Followed the LCD example 12.1 in assembly from Mazidi's AVR microcontroller's text, having read up on all the requirements to get a 14-pin LCD to work, which is very similar to the 14-pin vfd I'm using. I had to alter the code a bit for it to compile in avrstudio5. I have a number of questions:

1)I previously had a simple blinking program on the board from arduino.cc IDE, yet when I try to upload the hex file for eg 12.1 onto the board using tools>arduino upload in avrstudio5, and getting the avrdude verification with a thank you note, I still see the blinking program I had on.

2) I  used the portB 8bit single port sketch I derived from eg12.5, which compiles. I'm getting data pin 0 has 0volts, data pin 1 has 4.8volts unlike the other data pins, and the other data pins 3.8volts, logic 1 for activation; the rs, en pins both sit at 4.8volts, w/r pin at grd, and vss and vdd are at 0 and 5 volts resp...... nothing shows up.  I take it digital pins 2->9 represent portB data pins? There seems to be some issue with dpins 0 and 1.  I take it all pins should be high for anything to occur; wondering what could be causing these voltages on these pins?
 
3) Another thought here. You'd want to think the LCD script should apply equally well to a VFD in terms of hex file generation for the processor to execute. Do you think there may be timing differences in terms of when data is written when the enable pin is high or low.
Pages: 1 [2]