Created By: Hussein Nosair
This code is not tested yet.
1: int row = Integer.parseInt(JOptionPane.showInputDialog("Enter Row"));
2: jTable1.setRowSelectionInterval(row, row);
Posted by Circuit Negma on April 30, 2009
Created By: Hussein Nosair
This code is not tested yet.
1: int row = Integer.parseInt(JOptionPane.showInputDialog("Enter Row"));
2: jTable1.setRowSelectionInterval(row, row);
Posted in Java | 1 Comment »
Posted by Circuit Negma on April 15, 2009
Created By: Hussein Nosair
The following routine will aid in displaying a hex value to LCD character display.
1: /********************************************************************
2: * Function Name: HextoASCII *
3: * Return Value: None *
4: * Parameters: unsigned hex number *
5: * Description: This routine will display a hex number on *
6: * LCD by converting the number to ASCII *
7: ********************************************************************/
8: void HextoASCII(unsigned char *hex)
9: {
10: unsigned char temp_L; // dummy variable that will hold LSBs of Hex number
11: unsigned char temp_H; // dummy variable that will hold MSBs of Hex number
12:
13: temp_H = *hex & 0xF0; // Obtain the upper 4 bits (MSBs) of hex number
14: temp_H = temp_H >> 4; //
15: if(temp_H >9) // Check if the number is a letter
16: temp_H += 0x37; // Convert the number to a letter in ASCII
17: else
18: temp_H += 0x30; // Convert the number to ASCII number
19:
20: LCDWriteData(temp_H); // Display the number
21:
22: temp_L = *hex & 0x0F; // Obtain the lower 4 bits (LSBs) of hex number
23: if(temp_L >9) // Check if the the number is a letter
24: temp_L += 0x37; // Convert the number to a letter in ASCII
25: else
26: temp_L += 0x30; // Convert the number to ASCII number
27:
28: LCDWriteData(temp_L); // Display the number
29: }
Ex:
Hex number = 0×3F
1. If try to send 3F to the LCD directly, the LCD will display ? on screen, due to the fact that the LCD uC works with ASCII characters and thus the equivalent character for 3F is ?. CHECK THIS VALUE WITH ASCII TABLE.
2. If try to convert the hex to string/ASCII using itoa(), then the LCD will display the equivalent decimal value of 3F = 63.
3. Using the above routine :: HextoASCII(0×3F), the LCD will display the 3F on screen.
Posted in C Programming, Microchip PIC | Leave a Comment »