Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] overlaps current code and lcd_out

Status
Not open for further replies.

bestrider14

Member level 1
Joined
Feb 27, 2015
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
300
Hi,

I got i new trouble today. I can't use the fonction Lcd_Out(1,1, "hello!");, if i use it when i try to program my pic in IPEv2 i get this warning:
"fly3.hex code overlaps current code and will overwrite it."

everything esle work in my code, if i use

Code:
test = fontion();
Lcd_Out(1,1 ,test);

its work but whit this fonction i get a number. So i think where the bug is is when i try to put lettre on my lcd. i try to make a .hex for just display a hello on my ldc and it work but on my main projet no :/

thanks
 

Hum finaly a do some test and now

Code:
//LCD
sbit LCD_RS at LATB5_bit;
sbit LCD_EN at LATB4_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;

sbit LCD_RS_Direction at TRISB5_bit;
sbit LCD_EN_Direction at TRISB4_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
//END

void Main()
{
  Lcd_Init();
  Lcd_Cmd(_LCD_CURSOR_OFF);
  Lcd_Out(1,1,"test");
}

wont work. get the same warning and if i try to program it anyway my pic reboot in loop.
 

What device are you using ? If PIC16F then replace LAT with R in LCD defines. It should be RB5_bit like that. Only for PIC16F or 18F it is correct.

There should be a while(1) loop at the end of the code.

Try this. PIC will stop rebooting.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//LCD
sbit LCD_RS at LATB5_bit;
sbit LCD_EN at LATB4_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;
 
sbit LCD_RS_Direction at TRISB5_bit;
sbit LCD_EN_Direction at TRISB4_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
//END
 
void Main()
{
  Lcd_Init();
  Lcd_Cmd(_LCD_CURSOR_OFF);
  Lcd_Out(1,1,"test");
 
 
  while(1) {   }
}

 

Its a dsPIC33FJ128MC802. I delete the loop just for see what crash my code, but loop or not its still the same
 

WDT is resetting the PIC and hence you see garbage on LCD. Before the LCD_Out is fully executed MCU is resetting due to WDT. Zip and post your complete mikroC PRO dsPIC project files. I will check the project settings.
 

I dont think is the WDT cause if i comment the line Lcd_Out the warning go out and my pic run well. but i put the projet in the post just in case :p
 

Attachments

  • test2.rar
    65 KB · Views: 94

Try the .hex file I have attached. If it works then your compiler is generating wrong .hex file.
 

Attachments

  • test2.rar
    64.1 KB · Views: 85
Yeah its work. So now how i can resolve this bug.

EDIT.

i have try to recompile your code i got this

0 1501 Specified search path does not exist: 'C:\Program Files (x86)\Mikroelektronika\mikroC PRO for dsPIC\defs'
0 1501 Specified search path does not exist: 'C:\Program Files (x86)\Mikroelektronika\mikroC PRO for dsPIC\uses'
0 1501 Specified search path does not exist: 'C:\Users\System Administrator\Desktop\Projects\Others Projects\mikroElektronika\mikroC PRO\dsPIC\test2'

- - - Updated - - -

Its work now :) i update my mikroc :p thanks for your help :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top