| Author |
Message |
|
|
Posted: Feb 24, 2012 - 12:43 PM |
|


Joined: Mar 27, 2002
Posts: 18531
Location: Lund, Sweden
|
|
When a multimeter is set to measure amps, it should be connected in series.
Was it so when you meaured amps? |
|
|
| |
|
|
|
|
|
Posted: Feb 24, 2012 - 03:29 PM |
|

Joined: Feb 22, 2012
Posts: 28
|
|
Nevermind the amps.
Okey, I connected everything on pins 1,2,3 & 18,19,20 so thats working now. I have backlight and I can adjust the contrast.
So the next step is to send something to the display via my stk500 & atmega16. Clawson linked some drivers that I could use but how do I use them? Do I just #include them in my program? Im using C in AvrStudio5 |
|
|
| |
|
|
|
|
|
Posted: Feb 24, 2012 - 08:29 PM |
|


Joined: Sep 04, 2002
Posts: 21251
Location: Orlando Florida
|
|
We are assuming you can edit, compile, burn and run a simple c program to do something like blink an led, and you just want help with the lcdinit and lcdputchar and lcdputsring functions. OK so far?
I think most avrfreaks would pick 4 bit mode and no busy check, because it just takes 6 outputs. The 4 data bits should probably be the 7654 bits in a port, then you can use two more for E and RS. These lcd lines are up in the top of the lcd routines in some user configuarable defines. Edit the file to match how you have it wired up. Write a test program that calls lcdinit() then calls lcdputstring("HI THERE"); |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: Feb 24, 2012 - 08:42 PM |
|


Joined: Mar 27, 2002
Posts: 18531
Location: Lund, Sweden
|
|
|
Quote:
nevermind the amps
Ok. Please ask questions that you really want us to work with twice so that we can distinguish them from questions you ask that we should not care about.
I was about to point you to several good small demo programs but will await a repeated question fearing a post with good links might be answered 'nevermind...' |
|
|
| |
|
|
|
|
|
Posted: Feb 24, 2012 - 09:16 PM |
|


Joined: Jul 18, 2005
Posts: 62230
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
I think most avrfreaks would pick 4 bit mode and no busy check, because it just takes 6 outputs. The 4 data bits should probably be the 7654 bits in a port, then you can use two more for E and RS.
Bob, this ain't an HD44780, it's a KS0108 graphic controller?? |
_________________
|
| |
|
|
|
|
|
Posted: Feb 25, 2012 - 08:52 PM |
|

Joined: Feb 22, 2012
Posts: 28
|
|
|
JohanEkdahl wrote:
Quote:
nevermind the amps
Ok. Please ask questions that you really want us to work with twice so that we can distinguish them from questions you ask that we should not care about.
I was about to point you to several good small demo programs but will await a repeated question fearing a post with good links might be answered 'nevermind...'
You'r right.
I'm sorry. |
|
|
| |
|
|
|
|
|
Posted: Feb 25, 2012 - 09:20 PM |
|


Joined: Sep 04, 2002
Posts: 21251
Location: Orlando Florida
|
|
| You are right Cliff. Guess we should mention that there are several ks0108 graphics routines c source files in the projects section here. |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 01:51 PM |
|

Joined: Feb 22, 2012
Posts: 28
|
|
Im trying to use the drivers from this site:
http://en.radzio.dxp.pl/ks0108/
Im including KS0108.h , KS0108.c, graphic.h graphic.c and KS0108-AVR.c and trying to use some of the commands.
But nothing happens. Im trying to draw lines and rectangles and so on. But all the leds are just white |
|
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 02:21 PM |
|


Joined: Jul 18, 2005
Posts: 62230
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
Did you see the ST32 example on their site? Are you doing the same calls as shown in that? That is:
Code:
int main(void)
{
GLCD_Initialize();
GLCD_ClearScreen();
GLCD_GoTo(0,0);
GLCD_WriteString("+-------------------+");
GLCD_GoTo(0,1);
GLCD_WriteString("| Universal |");
GLCD_GoTo(0,2);
GLCD_WriteString("| KS0108 library |");
GLCD_GoTo(0,3);
GLCD_WriteString("| |");
GLCD_GoTo(0,4);
GLCD_WriteString("| en.radzio.dxp.pl |");
GLCD_GoTo(0,5);
GLCD_WriteString("| STM32 Cortex-M3 |");
GLCD_GoTo(0,6);
GLCD_WriteString("| microcontrollers |");
GLCD_GoTo(0,7);
GLCD_WriteString("+-------------------+");
for( ; ; );
return 0;
}
|
_________________
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 03:10 PM |
|

Joined: Feb 22, 2012
Posts: 28
|
|
Yes I tried that, It still doesnt show anything. But how does it know that i have my data bus line in PORTC and so on?
Now i connected all Data pins to PORT C PD0->PD7
and the instruction pins (4, 5, 6, 15, 16, 17) to PORTD |
|
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 03:13 PM |
|


Joined: Jul 18, 2005
Posts: 62230
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
Did you see these lines at the top of ks0108-avr.c:
Code:
#define KS0108_DATA_PORT PORTA
#define KS0108_DATA_DIR DDRA
#define KS0108_DATA_PIN PINA
#define KS0108_CTRL_PORT PORTC
#define KS0108_CTRL_DIR DDRC
#define KS0108_RS (1 << 2)
#define KS0108_RW (1 << 1)
#define KS0108_EN (1 << 0)
#define KS0108_CS1 (1 << 6)
#define KS0108_CS2 (1 << 5)
#define KS0108_CS3 (1 << 5)
Clearly you need to edit them to match your hardware. |
_________________
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 03:43 PM |
|

Joined: Feb 22, 2012
Posts: 28
|
|
I change them like this to match my setup. Still didnt work.
Code:
#define KS0108_DATA_PORT PORTC
#define KS0108_DATA_DIR DDRC
#define KS0108_DATA_PIN PINC
#define KS0108_CTRL_PORT PORTD
#define KS0108_CTRL_DIR DDRD
|
|
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 03:59 PM |
|


Joined: Jul 18, 2005
Posts: 62230
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
Time to put on your debugging cap. Something as complex as a KS0108 often does not work on day one - this then sorts the engineers from the boys
(BTW you mentioned the PINs/PORTS - you did also make sure all the other _RS, _RW, _EN etc #defines were changed to match too?) |
_________________
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 09:21 PM |
|


Joined: Mar 28, 2001
Posts: 20336
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
|
Quote:
I change them like this to match my setup. Still didnt work.
#define KS0108_DATA_PORT PORTC
Look at the FAQ #5 in Cliff's post above, it may help. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Mar 01, 2012 - 02:55 AM |
|


Joined: Sep 04, 2002
Posts: 21251
Location: Orlando Florida
|
|
| And the KS0108 has timing requirements that wont be correct if the clock rates between the referenced example and the targeted example are not close/same. Lots of folks have a hard time getting their target to run at the speed they want. Know how the AVR fuses get set and reset to enable the external crystal and etc? |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: Mar 01, 2012 - 02:42 PM |
|

Joined: Feb 22, 2012
Posts: 28
|
|
|
clawson wrote:
Did you see these lines at the top of ks0108-avr.c:
Code:
#define KS0108_DATA_PORT PORTA
#define KS0108_DATA_DIR DDRA
#define KS0108_DATA_PIN PINA
#define KS0108_CTRL_PORT PORTC
#define KS0108_CTRL_DIR DDRC
#define KS0108_RS (1 << 2)
#define KS0108_RW (1 << 1)
#define KS0108_EN (1 << 0)
#define KS0108_CS1 (1 << 6)
#define KS0108_CS2 (1 << 5)
#define KS0108_CS3 (1 << 5)
Clearly you need to edit them to match your hardware.
I don't know what RS RW EN and so on correseponds to my setup? I think
D/I is RS
R/W Is RW
E Is EN
CS1 Is CS1
CS2 Is CS2
RST not used in KS0108-avr.c
CS3 is not used either... I just deleted everything related to CS3 in the ks0108-avr.c file
Still doesnt work. |
|
|
| |
|
|
|
|
|
Posted: Mar 01, 2012 - 03:30 PM |
|


Joined: Jul 18, 2005
Posts: 62230
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
Still doesnt work.
Did you take into account the point Bob made - there could be timing constraints that are being exceeded. One way to check is to slow the AVR code down so that everything goes very slowly and any delays are far larger than they need to be. Depending on the AVR this is often as simple as putting a large value in the CLKPR register. |
_________________
|
| |
|
|
|
|
|
Posted: Mar 01, 2012 - 03:41 PM |
|

Joined: Feb 22, 2012
Posts: 28
|
|
how exactly do I change the CLKPR register?
I can change under fuses to 1Mhz. |
|
|
| |
|
|
|
|
|
Posted: Mar 01, 2012 - 03:45 PM |
|


Joined: Jul 18, 2005
Posts: 62230
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
| Ah sorry, I realise now you have a mega16 - so you don't have a CLKPR register. As you say, changing the fuses to 1MHz internal RC is probably the slowest option it's possible to obtain easily. |
_________________
|
| |
|
|
|
|
|
Posted: Mar 01, 2012 - 03:51 PM |
|

Joined: Feb 22, 2012
Posts: 28
|
|
| Ok, I had it already set at 1Mhz, any other ideas what could be wrong? |
|
|
| |
|
|
|
|
|