Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 10th July 2009, 05:12 AM   #61
Default

thanks, that made some progress, and got rid of the error, but um...

Code:
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:22:Warning [2058] call of function without prototype
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:27:Error [1105] symbol 'TRISC' has not been defined
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:27:Error [1101] lvalue required
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:30:Warning [2058] call of function without prototype
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:31:Warning [2058] call of function without prototype
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:33:Warning [2058] call of function without prototype
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:34:Warning [2066] type qualifier mismatch in assignment
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:36:Warning [2058] call of function without prototype
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:37:Warning [2066] type qualifier mismatch in assignment
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:40:Warning [2058] call of function without prototype
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\main.h:41:Warning [2058] call of function without prototype
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\LCD.h:65:Error [1109] type mismatch in redeclaration of 'send_cmd'
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\LCD.h:66:Error [1109] type mismatch in redeclaration of 'send_data'
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\LCD.h:67:Error [1109] type mismatch in redeclaration of 'set_cursor'
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\LCD.h:71:Error [1109] type mismatch in redeclaration of 'sc_r'
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\LCD.h:75:Error [1109] type mismatch in redeclaration of 'lcd_init'
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\delay.h:12:Error [1109] type mismatch in redeclaration of 'delay250ms'
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:6:Error [1105] symbol 'PORTCbits' has not been defined
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:6:Error [1151] struct or union object designator expected
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:6:Error [1101] lvalue required
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:8:Error [1105] symbol 'PORTCbits' has not been defined
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:8:Error [1151] struct or union object designator expected
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:8:Error [1101] lvalue required
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:13:Error [1105] symbol 'PORTC' has not been defined
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:13:Error [1105] symbol 'PORTC' has not been defined
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:13:Error [1101] lvalue required
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:23:Error [1105] symbol 'PORTCbits' has not been defined
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:23:Error [1151] struct or union object designator expected
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:23:Error [1101] lvalue required
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:29:Error [1105] symbol 'PORTCbits' has not been defined
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:29:Error [1151] struct or union object designator expected
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:29:Error [1101] lvalue required
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:122:Error [1105] symbol 'PORTCbits' has not been defined
C:\Documents and Settings\Paul Sisneros\My Documents\pic project\LCD\lcd.c:122:Error [1151] struct or union object designator expected
this is going to take a while
Triode is offline  
Old 10th July 2009, 05:25 AM   #62
Default

It looks like you have things a bit tangled up to put it nicely.

Manyof the undefined symbols should have been defined in the processor header file which is obtained via

#include <p18cxxx.h>

Then there is this sort of error
:65:Error [1109] type mismatch in redeclaration of 'send_cmd'

It looks like you have an improperly setup project.
Others may disagree but I suggest you zip up the entire project and include it as an attachment. That way we can try to build the project and see where you have gone wrong.

3v0
__________________
Please post questions to the forums. PM's are for personal communication.

BCHS/3v0's Tutorials
Junebug USB PIC programmer kit., USB Bit Whacker,
The 15 Minute Printed Circuit Board! (+drill time)
3v0 is offline  
Old 10th July 2009, 01:43 PM   #63
Default

Thanks. I think I'll try to untangle it a bit myself before I do that though. I haven't actually spent that much time on it. I only get about an hour a night I can work on this stuff, and thats not uninterupted, so its slow going for my projects. I'm sure I did setup the project wrong. The blog I got it from didnt really say how to set it up. Though I guess if I was expierienced with C18, it would probably be pretty obvious.
Triode is offline  
Old 10th July 2009, 02:09 PM   #64
Default

Triode if you put all the file in one folder and add just the .h files it should work. From what you
posted it's adding the wrong ones.
And LCD.c and delay.c
C18 has a lcd.h and delay.h of it's own I would bet it using them.

Last edited by be80be; 10th July 2009 at 02:14 PM.
be80be is offline  
Old 10th July 2009, 02:14 PM   #65
Default

sorry, im a little confused by what you wrote at the end. What did you mean by "And LCD.c and delay.c " was that in addition to the things I should put in the folder, or the wrong ones?
Triode is offline  
Old 10th July 2009, 02:29 PM   #66
Default

Now that I can see the source it is clear I suggested a different definition for byte

Change
#define byte unsigned char;
to
typedef unsigned char byte; // no # char

That may fix the
Error [1109] type mismatch in redeclaration of 'send_cmd'
sort of errors.

To fix the undefined symbols try replacing
#include <p18cxxx.h>
with an include of the exact file you need.
If you chip were a 18F1320 you would use
#include <p18F1320.h>
Just adjust the number to fit you chip.
See how far that gets you.

3v0
__________________
Please post questions to the forums. PM's are for personal communication.

BCHS/3v0's Tutorials
Junebug USB PIC programmer kit., USB Bit Whacker,
The 15 Minute Printed Circuit Board! (+drill time)

Last edited by 3v0; 10th July 2009 at 02:29 PM.
3v0 is offline  
Old 10th July 2009, 02:59 PM   #67
Default

Just had a play with this and I had to make a few changes to main.c to get it to compile.
Code:
#include <p18cxxx.h>
#include <stdio.h>
#include <delays.h>
#include "delay.h"              //added
#include "LCD.h"

#pragma config OSC = INTIO67    //Internal oscillator
#pragma config IESO = OFF
#pragma config PWRT = ON
#pragma config BOREN = OFF
#pragma config WDT = OFF
#pragma config MCLRE = OFF     //MCLR is disabled
#pragma config LVP = OFF

/*                              //removed
void delay1s() {
    Delay10KTCYx(200);
}*/         

//User defined putc for user defined output stream
void _user_putc(unsigned char c) {
    send_data(c); //Send character to LCD
}

void main() {
    OSCCON = 0b01110010; //8 MHz
    TRISC = 0x00; //PORTC is all output
    stdout = _H_USER; //Set to user-defined output stream via _user_putc

    lcd_init(); //Initialize the LCD
    send_cmd(0x0C); //Turn off cursor

    set_cursor(1, 1); //Set cursor to row 1, column 1
    printf((far rom char*)"Hello!"); //Print "Hello!" to the LCD    <---changed

    set_cursor(2, 1); //Set cursor to row 2, column 1
    printf((far rom char*)"HD44780");                 // changed

    while(1) {
        delay250ms(); //Scroll the display 1 character right every 250 ms
        sc_r();
    }
}
Mike.
Pommie is online now  
Old 10th July 2009, 03:06 PM   #68
Default

what is

#pragma config OSC = INTIO67

My spec sheet for 18F1320 doesnt show there being a 67. Just 1 and 2

Thanks for the suggestions, It may be a while before I can implement them since when I get home tonight I'm going to start moving, haha. It may be monday evening before I get to work on my hobby any more. Oh well, thats life when you have to work isn't it?
Triode is offline  
Old 10th July 2009, 03:17 PM   #69
Default

I set MPLAB to use an 18F2620 so I didn't have to go through the code and change PORTC to PORTB. The config labels vary between chips and the 2620 uses INTIO67.

Mike.
Pommie is online now  
Old 10th July 2009, 03:22 PM   #70
Default

Yeah, I noticed that I will need to change that too. I'm doing this all on a junebug for now, So idealy I'll be setting it to ports that are easily accessable on the pin strip also.
Triode is offline  
Old 10th July 2009, 05:14 PM   #71
Default

Here the whole thing I think it will run on the junebug it built all right and I change it to use PORTB on a 18f1320 I didn't try it but it looked good
Mike I'm getting better now I know I need some of these {} LOL
I lied I will run on PORTB of a 18f1320 you'll have to do some more adjusting for the junebug
Attached Files
File Type: zip lcdjune.zip (41.7 KB, 3 views)

Last edited by be80be; 10th July 2009 at 05:21 PM.
be80be is offline  
Old 10th July 2009, 05:33 PM   #72
Default

How would you do a low order on PORTA you RA1 to RA4 for data
and RB1 could be Enable, RB3 could be Read/write, and RB4 could be Register select
But I don't see how you could do the low order with out RA0
You change this but how I don't no
Code:
void send_nibble(byte b) {
	LCD_PORT = (LCD_PORT & 0x0F) | (b & 0xF0);
	strobe();

Last edited by be80be; 10th July 2009 at 05:44 PM.
be80be is offline  
Old 10th July 2009, 05:35 PM   #73
Default

well, I dont know, I have bigger 18F chips if necessary.
Triode is offline  
Old 10th July 2009, 05:51 PM   #74
Default

Maybe this would work Mike or 3v0 maybe let us no
Code:
void send_nibble(byte b) {
	LCD_PORT = (LCD_PORT & 0x1E) | (b & 0x1E);
	strobe();
It'S in the LCD.c
be80be is offline  
Old 10th July 2009, 05:58 PM   #75
Default

Close,

LCD_PORT = (LCD_PORT & 0xE1) | ((b & 0x0f)<<1);

Note, E1 - not 1E.

Mike.
Pommie is online now  
Reply

Tags
c18, questions

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
A few questions erosennin Feedback/Comments 24 29th November 2007 12:08 AM
2 questions juan123 Electronic Projects Design/Ideas/Reviews 5 27th September 2007 03:46 AM
A few questions. Marks256 General Electronics Chat 55 5th August 2006 11:49 PM
few questions Victor Frankenstein General Electronics Chat 13 5th July 2005 07:29 PM
Questions? Philipc Electronic Projects Design/Ideas/Reviews 4 7th August 2003 07:18 PM



All times are GMT. The time now is 05:00 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker