User Tools

Site Tools

한국어

faduino:interfacing_with_the_uif-5k:index

Interfacing with the UIF-5K

The UIF-5K is a user interface panel with an character LCD and 5 input buttons that can be used with any RS-232 capable device, including the FADUINO.

Front Panel

1. Indicator LED
2. Input Keys/Buttons
3. Character LCD

Rear Panel

Connecting the FA-DUINO-12RA / 24RA

Connecting the FA-DUINO-32TA

Example Program 1

void setup() {
    Serial1.begin(115200);     // Baud Rate 115200
    uif_clear();               // Clear the LCD screen
    delay(20);
    uif_buzzer(1); delay(20);  // Buzzer ON
    uif_locate(0,0);
    Serial1.print("=== UIF 5K_TEST ===");delay(100);
    uif_locate(2,1);
    Serial1.print(" FA-DUINO-12RA "); delay(100);
}
 
void loop(){ }
 
// Clear the LCD screen
void uif_clear()
{ 
    Serial1.write(0x1b); Serial1.write(0x43); 
}
 
// Sets the x and y position of the character to be displayed
void uif_locate(unsigned char x, unsigned char y)
{ 
    Serial1.write(0x1b);Serial1.write(0x4C);Serial1.write(x); Serial1.write(y); 
}
 
// Turn buzzer ON/OFF
void uif_buzzer(unsigned char on_off)
{ 
    Serial1.write(0x1b);Serial1.write(0x5a);Serial1.write(on_off); 
} 

Example Program 2

void setup() 
{
    Serial1.begin(115200);      // Baud rate 115200
    uif_clear();                // Cleear the LCD screen
    delay(20);
    uif_light(1); delay(20);    // Turn backlight ON/OFF
    uif_buzzer(1); delay(20);   // Turn buzzer ON/OFF
    delay(100);
    uif_locate(0,0);
    Serial1.print("=== UIF 5K_TEST ===");delay(100);
    uif_locate(2,1);
    Serial1.print("comfiletech.com"); delay(100);
    uif_locate(2,2);
    Serial1.print("COUNTER : "); delay(100);
    uif_locate(2,3);
    Serial1.print("BUTTON : "); delay(100);
}
 
int cnt = 0;
 
void loop() 
{
    cnt++;                             // Increment the counter value
    uif_locate(12,2);
    Serial1.print(cnt, DEC);           // Display the counter value
    delay(100);
    serial1Event();
}
 
void serial1Event() 
{                                     // Display the button status
    while (Serial1.available()) 
    {
        char inChar = (char)Serial1.read();
        uif_locate(10,3);
        Serial1.print(inChar, DEC);
   }
}
 
// Turn cursor ON/OFF
void uif_csron(unsigned char on_off)
{
    if(on_off){Serial1.write(0x1b); Serial1.write(0x53);}
    else {Serial1.write(0x1b); Serial1.write(0x73);}
}
 
// Clear the entire screen
void uif_clear()
{ 
    Serial1.write(0x1b); Serial1.write(0x43); 
}
 
// Turn display backlight ON/OFF
void uif_light(unsigned char on_off)
{
    Serial1.write(0x1b);Serial1.write(0x42);Serial1.write(0x4c);
    Serial1.write(on_off); }
 
// Set the x,y position of the next character to display
void uif_locate(unsigned char x, unsigned char y)
{ 
    Serial1.write(0x1b);Serial1.write(0x4C);Serial1.write(x); Serial1.write(y); 
    }
 
// Turn main LED ON/OFF
void uif_swled(unsigned char on_off)
{ 
    Serial1.write(0x1b);Serial1.write(0x45);Serial1.write(on_off); 
}
 
// Turn a button LED ON/OFF
void uif_led(unsigned char number, unsigned char on_off)
{
    Serial1.write(0x1b);Serial1.write(0x46);Serial1.write(number);
    Serial1.write(on_off); 
}
 
//Turn Buzzer ON/OFF
void uif_buzzer(unsigned char on_off)
{ 
    Serial1.write(0x1b);Serial1.write(0x5a);Serial1.write(on_off); 
} 

FA-DUINO Industrial Arduino

faduino/interfacing_with_the_uif-5k/index.txt · Last modified: 2022/11/20 08:01 by COMFILE Technology