TVI Electronics, LLC Forum Index TVI Electronics, LLC
 Touch Screen LCD Module Support Forum 
 FAQFAQ   SearchSearch   Homepage   MemberlistMemberlist   UsergroupsUsergroups 
 RegisterRegister   Log inLog in 
The time now is Fri Sep 10, 2010 2:26 pm
All times are UTC - 5 (DST in action)
View posts since last visit
View unanswered posts
 Forum index » General Discussion » Firmware Forum
Code for testing
Post new topic   Reply to topic View previous topicView next topic
Page 1 of 1 [8 Posts]  
Author Message
gabyramos


Offline Joined: 04 Jul 2007
Posts: 3
Location: Mexico
Country Flag:
 Code for testing

Hi,
I am using F-51852 Optrex display,
Do you have an easy code that i can prove in my application?
I want to know if my hardware is right connected, because i can't see the pixels on.

Thanks

PostPosted: Fri Aug 31, 2007 4:26 pm
 View user's profile Send private message
Reply with quote Back to top 
vivat
Site Admin


Offline Joined: 28 Nov 2004
Posts: 70
Location: USA
Country Flag:
Please provide me with more information so I can better assist you. What controller are you using with your F-51852 display? What microcontroller are you using in your application?
_________________
Support Group,
TVI Electronics

PostPosted: Fri Aug 31, 2007 4:42 pm
 View user's profile Send private message Visit poster's website
Reply with quote Back to top 
gabyramos


Offline Joined: 04 Jul 2007
Posts: 3
Location: Mexico
Country Flag:
I'm using F-51852GNBJ with a NJU6676 controller and i'm running my application in a MSP430 (Texas Instruments microController).
My main problem is that I can not display my data in the screen.
Thanks for your attention

GabyRamos

PostPosted: Mon Sep 03, 2007 10:58 am
 View user's profile Send private message
Reply with quote Back to top 
vivat
Site Admin


Offline Joined: 28 Nov 2004
Posts: 70
Location: USA
Country Flag:
I'm not familiar with the MSP430. In our TC553/852 controller we utilize the Atmega16 MCU. You need to make sure your VCC for LCD is 5V. Also make sure you use the proper initialization sequence for your display.
_________________
Support Group,
TVI Electronics

PostPosted: Mon Sep 03, 2007 7:17 pm
 View user's profile Send private message Visit poster's website
Reply with quote Back to top 
bmhill


Offline Joined: 25 Nov 2007
Posts: 2
Location: West Lafayette, IN
Country Flag:
 Sample Code for the TC553/852
Need Help

I have a TC553/852 and am using an ATMega16 and wanted to know if you have any sample code to test the LCD with the micro?

PostPosted: Sun Nov 25, 2007 9:19 pm
 View user's profile Send private message Send e-mail
Reply with quote Back to top 
vivat
Site Admin


Offline Joined: 28 Nov 2004
Posts: 70
Location: USA
Country Flag:
Below are some code snippets that can be used in order to test your LCD with the TC553/852 controller and Atmega16 micro. Make sure you connect RxD and TxD from TC553/852 controller to TxD and RxD on Atmega16 and use a common ground (GND). For a connection diagram refer to the most up-to-date TC553/852 Controller User's Manual.

Code:
/* uart_rx is a global
use interrupt handler to update
example   

#pragma interrupt_handler uart0_rx_isr:12
void uart0_rx_isr(void)
{
 //uart has received a character in UDR
 uart_rx = getchar();
}

don't forget to set up UART
*/

// *****************************************************************************
void wait_for_response(void)
{
 uart_rx = 0;
 while(uart_rx == 0);
}
// *****************************************************************************
void clear_screen(void)
{
 printf("%c",1); // clear screen
 printf("%c",1); // clear screen
 wait_for_response();
}
// *****************************************************************************
void start_p_c(char page, char column)
{
 printf("%c",6); // start page
 printf("%c",page); // page number
 printf("%c",18); // start column
 printf("%c",column); // column number
 wait_for_response();
}
// *****************************************************************************
void line_draw(char start_x, char start_y, char stop_x, char stop_y)
{
 printf("%c",30); //  line
 printf("%c",0); // draw
 printf("%c",start_x); // start x
 printf("%c",start_y); // start y
 printf("%c",stop_x); // stop x
 printf("%c",stop_y); // stop y
 wait_for_response();
}
// *****************************************************************************
void rectangle_draw(char rectangle, char start_x, char start_y, char stop_x, char stop_y)
{
 printf("%c",30); //  rectangle
 printf("%c",rectangle); // draw
 printf("%c",start_x); // start x
 printf("%c",start_y); // start y
 printf("%c",stop_x); // stop x
 printf("%c",stop_y); // stop y
 wait_for_response();
}
// *****************************************************************************
void font_select(char font)
{
 printf("%c",21); //  font select
 printf("%c",font); //  font
 wait_for_response();
}
// *****************************************************************************
void print_font(char font)
{
 printf("%c",2); //  text mode
 printf("%c",font); //  font
 wait_for_response();
}
// *****************************************************************************
void hello(void)
{
 char message[5]= {'H','e','l','l','o'};
 char i;
 int k;
 for(i=0;i<5;i++)
   {
    print_font(message[i]);
   for(k=0;k<3000;k++); //delay
   } 
}
// *****************************************************************************
void main(void)
{
 init_devices();
 uart_rx = 0;
 clear_screen();
 line_draw(62,0,62,63); //line from 62,0 to 62,63
 line_draw(63,0,63,63); //line from 63,0 to 63,63
 line_draw(0,31,127,31); //line from 0,31 to 127,31
 font_select(1); // 1 for font 5x7, 2 for font 8x14, 3 for font 8x14 Bold
 start_p_c(1,5); // page,column
 hello();
 font_select(2); // 1 for font 5x7, 2 for font 8x14, 3 for font 8x14 Bold
 start_p_c(1,70); // page,column
 hello();
 font_select(3); // 1 for font 5x7, 2 for font 8x14, 3 for font 8x14 Bold
 start_p_c(5,5); // page,column
 hello();
 start_p_c(5,70); // page,column
 hello();
 rectangle_draw(3, 69, 40, 101, 55);// box, start_x, start_y, stop_x, stop_y
}

_________________
Support Group,
TVI Electronics

PostPosted: Mon Nov 26, 2007 9:12 am
 View user's profile Send private message Visit poster's website
Reply with quote Back to top 
bmhill


Offline Joined: 25 Nov 2007
Posts: 2
Location: West Lafayette, IN
Country Flag:
 sample code issue
code

I was testing the sample code but when I try to compile the code the #pragma interrupt is not recognized and I was wondering if there is another way in which this command can work or if you know how to make this work with the ATMega16 on codevisionAVR

PostPosted: Tue Nov 27, 2007 6:14 pm
 View user's profile Send private message Send e-mail
Reply with quote Back to top 
vivat
Site Admin


Offline Joined: 28 Nov 2004
Posts: 70
Location: USA
Country Flag:
The code above assumes that all peripherals have been initialized. Below is an example of initialization of the Atmega16 UART and its PORTs. You might need to change the header (include) files according to your compiler. Typically, header files are included via compiler directives at the beginning of the source file. A precompiled header file will be searched for when #include is seen in the compilation.

Code:
#include <mega16.h>
#include <stdio.h>

char uart_rx;

void port_init(void)
{
 PORTA = 0xFF;
 DDRA  = 0xFF;
 PORTB = 0xFF;
 DDRB  = 0xFF;
 PORTC = 0xFF;
 DDRC  = 0xFF;
 PORTD = 0xFF;
 DDRD  = 0xFF;
}

//UART0 initialize
// desired baud rate: 9600
// actual: baud rate:9600 (0.0%)
// char size: 8 bit
// parity: Disabled
void uart0_init(void)
{
 UCSRB = 0x00; //disable while setting baud rate
 UCSRA = 0x00;
 UCSRC = 0x06;
 UBRRL = 0x3B; //set baud rate lo
 UBRRH = 0x00; //set baud rate hi
 UCSRB = 0xD8;
}

#pragma interrupt_handler uart0_rx_isr:12
void uart0_rx_isr(void)
{
 //uart has received a character in UDR
 uart_rx = getchar();
}

#pragma interrupt_handler uart0_tx_isr:14
void uart0_tx_isr(void)
{
 //character has been transmitted
}

//call this routine to initialize all peripherals
void init_devices(void)
{
 //stop errant interrupts until set up
 CLI(); //disable all interrupts
 port_init();
 uart0_init();
 MCUCR = 0x00;
 GICR  = 0x00;
 TIMSK = 0x00; //timer interrupt sources
 SEI(); //re-enable interrupts
 //all peripherals are now initialized
}

_________________
Support Group,
TVI Electronics

PostPosted: Tue Nov 27, 2007 7:43 pm
 View user's profile Send private message Visit poster's website
Reply with quote Back to top 
Display posts from previous:   Sort by:   
Page 1 of 1 [8 Posts]  
Post new topic   Reply to topic View previous topicView next topic
 Forum index » General Discussion » Firmware Forum
Jump to:  

You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You cannot delete your posts in this forum
You can vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

© 2004-2010 TVI Electronics, LLC. All Rights Reserved. Forum with support of Syndicator RSS