USART on a GLCD

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let me come right to the problem.

I intend to make a small+portable+battery powered AVR Device which has a GLCD (not too big, I shall use 128x64 which I already have) and a few buttons.

What I want is that it should be able to show data received from USART on the GLCD line by line, nothing more, it doesn't need to send anything back but only receive and show text on LCD. The buttons can be used to set the baud rate etc and other such settings.

So, I want to ask where to begin or if someone has already made such a device and posted here (I have searched but failed, maybe I am not searching with the right word). I want to make it using ATMEGA32/16 or even 8, using AVR-GCC in AVR Studio. I already have enough knowledge to start on it, but I wanted to get some opinions from here as well.

The need for such a device is arising that I lack basic equipment like logic analyzers etc and I dont have a scope at home, so I have to rely on USART data and JTAG. but recently I have lost my PC with Serial port and laptops dont come with serial ports anymore, so I was wondering about making such a device.

THANK YOU ALL FOR THE HELP THAT YOU GUYS PROVIDE HERE....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Its a terminal program. You need to write these small single function programs one at a time: 1) Flash led in a loop 1 sec on 3 sec off. Different on off time is to get on and off right side up. 2) Init uart to 38400 and send UUUUUU in a loop. Make sure you can read this in any pc terminal program. 3)Write the kbhit() and getchar() function. Now you can combine the led flash and echo back chars. The kbhit function returns true if there is a char in the uart waiting to be read. 4)init glcd. Make a menu that will fill screen when you hit 1 and clear screen when you hit 2 8 bits at a time 5)write setpixel(x,y) routine. 6)Write routine to write a 5x7 dot char. Search here for font5x7... there are lots of them. 7) Write a putstring() to glcd command at adds 6 dots to x after writing each 5x7 char out to the glcd. I guess 8) is the final program. Might need to use receive interrupt to grab the chars so you dont miss any. Hope this helps.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A lot will depend on the 128x64 you plan to use. What graphics controller does it have? KS0108? T6963 (is it?)? The UAT receive stuff is going to be trivial compared to driving a pixel programmable LCD panel and especially doing fonts but the advantage of KS0108 (say) is that this has all been done before and AVR compilable code is widley available.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner & clawson:

Thanks for the very EARLY replies.

I already have the GLCD working with simple text etc, using a library found here, I am writing this so that I dont require a PC every time I need to view the USART messages.

The GLCD is Clover CV12864B.

I wanted to know about your opinions if something like this is already made here (sparing me the trouble) and also if there is anything USART specific which needs to be considered in the design. like Oscillator selection and if there is a way to automatically detect settings of the USART device attached...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But if the LCD can already show text then the rest is trivial isn't it? You use a routine to either sit in a loop waiting for UART characters to arrive or you setup to get an interrupt when this occurs. You then write each received character at the "next" position on the screen and when you receive the special characters '\n' you go don to the next line and for '\r' you move back to column 1 - that's pretty much all you require isn't it?

Maybe turn this around: shows what you have working already and where you think there may be problems.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay, so here is my first version, it is showing all text sent from the Virtual Terminal of this simulation, currently my GLCD is hooked up in another project, otherwise I would have had done it on hardware too...

NOW, my mind is wandering off... about how to recognize the baud rate etc without providing any info, (for now a settings menu in the beginning will suffice, will add that later). Also what about other similar communication protocols, or how about if it is hooked up with a cell-phone like keypad to send USART data as well, though implementing that cell-phone style no dictionary input will be something difficult for me (i.e. take time).

So, what do you suggest, also now, am thinking of getting a bigger GLCD or is there a smaller font available. Currently I have used the Peter Fleury's Library.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can do auto-baud detection by tying the RXD pin across to an ext-int or ICP pin then at the start you use a timer to measure the start bit width. This relies on having a 0 bit after the start bit. A character such as '\r' (0x0D) would work so you could tell the user to keep sending [enter] until the device responds (maybe by saying something like "CONNECT 19200 baud" or whatever).

BTW your diagram shows nothing connected to the XTAL1/XTAL2 pins - for accurate UART usage this would probably be a big mistake!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

BTW your diagram shows nothing connected to the XTAL1/XTAL2 pins - for accurate UART usage this would probably be a big mistake!

Oh, yes of course when I will try it on hardware, I will be putting in an external crystal...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

how about if it is hooked up with a cell-phone like keypad to send USART data as well, though implementing that cell-phone style no dictionary input will be something difficult for me (i.e. take time).

Well, I found solution for my own mentioned feature.

The cell-phone-like-keypad is provided with complete code in an Application Note....

AVR243: Matrix Keyboard Decoder

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could use the avr a/d to make a scope

Imagecraft compiler user