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.

Does proteus support c-language? Is there a way around it?

Status
Not open for further replies.

libyantiger

Member level 5
Joined
Aug 10, 2016
Messages
90
Helped
0
Reputation
0
Reaction score
3
Trophy points
1,288
Activity points
2,269
Does proteus support c language is there in way around it

i have studies assembly for quit some time ...it is tedious now after read some chapters about c i got nice code

that i need to test in proteus but then i find error message said the selected compiler is not installed ..i cant install it


is there any way to use external C compiler then get the result of the compilation process and reput it inside the microcontroller

as assembly language

because my protus can only accept assembly language ?
 

Re: does proteus support c language is there in way around it

because my protus can only accept assembly language

Did you even search anywhere before asking this question ? Proteus DO accept C language, although from a limited number of compiler options. If the compiler is not installed, just click on the download button, at "compiler configuration" menu, from Source Code tab
 

Re: does proteus support c language is there in way around it

Proteus does not include a compiler, it loads binary files with or without debug information. With appropriate debug information (e.g. *.cof files for PIC), you can perform source level debugging in Proteus.
 
Re: Does proteus support c language is there in way around it

i have downloaded evaluation version of the compiler high-tech c compiler from micrchip for pic 18


i find nice code in this link it is simple code that shows some characters on lcd

https://www.rhydolabz.com/wiki/?p=9711


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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*************************************************************************
                           HEADER FILES
**************************************************************************/
#include<pic18.h>                 
 
/*************************************************************************
                       FUNCTION DECLARATIONS
**************************************************************************/
void Delay_us(int us);
void Data(int Value);           
void Cmd(int Value);            
void Send2Lcd(const char Adr, const char *Lcd);
 
/*************************************************************************
                           MAIN FUNCTION
**************************************************************************/
void main()                     
{
 TRISC=0X00;                  /* PORTC(control lines) configured as o/p  */
 TRISD=0X00;                  /* PORTD(data lines) configured as o/p     */
 Delay_us(25);              
 Cmd(0X30);                   /* LCD Specification Commands              */
 Delay_us(25);     
 Cmd(0X30);                   /* LCD Specification Commands              */
 Delay_us(25);      
 Cmd(0X30);                   /* LCD Specification Commands              */
 Delay_us(25);   
 Cmd(0X38);                   /* Double Line Display Command             */
 Cmd(0X06);                   /* Auto Increment Location Address Command */
 Cmd(0X0C);                   /* Display ON Command                      */
 Cmd(0X01);
 Delay_us(1000);              /* Clear Display Command                   */
 Send2Lcd(0x84,"rhydoLABZ");  /* Displays string in the first line       */
 Send2LCD(0xc5,"Cochin");     /* Displays string in the second line      */
 while(1);
}
 
/*************************************************************************
* Function    : Cmd                                                      *
*                                                                        *
* Description : Function to send a command to LCD                        *
*                                                                        *
* Parameters  : Value - command to be sent                               *
**************************************************************************/
void Cmd(int Value)
{
 PORTD = Value;               /* Write the command to data lines         */
 RC0   = 0;                   /* RS-0(command register)                  */
 RC1   = 1;                   /* E-1(enable)                             */
 Delay_us(25);                
 RC1   = 0;                   /* E-0(enable)                             */
}
 
/*************************************************************************
* Function    : Data                                                     *
*                                                                        *
* Description : Function to display single character on LCD              *
*                                                                        *
* Parameters  : Value - character to be displayed                        *
**************************************************************************/
void Data(int Value)
{
 PORTD = Value;               /* Write the character to data lines       */
 RC0   = 1;                   /* RS-1(data register)                     */
 RC1   = 1;                   /* E-1(enable)                             */
 Delay_us(25);                
 RC1   = 0;                   /* E-0(enable)                             */
}
 
/*************************************************************************
* Function    : Send2LCD                                                 *
*                                                                        *
* Description : Function to display string on LCD                        *
*                                                                        *
* Parameters  : loc - location                                           *
*               String to be displayed                                   *
**************************************************************************/
void Send2Lcd(const char Adr, const char *Lcd)
{
 Cmd(Adr);                    /* Address of location to display string   */
 while(*Lcd!='\0')            /* Check for termination character         */
 {  
  Data(*Lcd);                 /* Display the character on LCD            */ 
  Lcd++;                      /* Increment the pointer                   */
 }
}
 
/*************************************************************************
* Function    : Delay_us                                                 *
*                                                                        *
* Description : Function for 1 microsecond delay                         *
*                                                                        *
* Parameter   : us - delay in microseconds                               *
**************************************************************************/
void Delay_us(int us)
{
 us=us>>1;
 while(us!=1)
 us--;
}
 
/***************************  END OF PROGRAM  ****************************/



i managed to allow proteus use and find the high-tech c because it only have the assembly compiler pre-installed

however when compiling the 100 percent correct i code i was suprised with these errors

the only thing i did as that i have delected all the the writings pre-written in the compiler and paste the code for the program in link

i am good at assembly but it is tedious and it is time to use c ...however it was very awkward start

so this is what i get can you tell me what is wrong
--------------------------------------------------------------------------------------------------------------------------------------

picc18.exe --pass1 --errformat="Error at file %%f line %%l column %%c: (%%n) %%s" --warnformat="Warning at file %%f line %%l column %%c: (%%n) %%s" --msgformat="Message at file %%f line %%l column %%c: (%%n) %%s" -D_XTAL_FREQ=1000000 -G --chip=18F4580 -O"main.p1" "../main.c"
Licensed for evaluation purposes only.
This licence will expire on Sat, 20 Jan 2018.
HI-TECH C Compiler for PIC18 MCUs (PRO Mode) V9.80
Copyright (C) 2011 Microchip Technology Inc.
Message at file line column : (1233) Employing 18F4580 errata work-arounds:
Message at file line column : (1234) * Corrupted fast interrupt shadow registers
Warning at file ../main.c line 39 column 1: (361) function declared implicit int
Warning at file ../main.c line 53 column 8: (1385) variable "RC0" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16042)
Warning at file ../main.c line 54 column 8: (1385) variable "RC1" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16044)
Warning at file ../main.c line 56 column 8: (1385) variable "RC1" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16044)
Warning at file ../main.c line 69 column 8: (1385) variable "RC0" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16042)
Warning at file ../main.c line 70 column 8: (1385) variable "RC1" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16044)
Warning at file ../main.c line 72 column 8: (1385) variable "RC1" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16044)
picc18.exe --output=mcof -G --chip=18F4580 -O"Debug.cof" "main.p1"
../main.c: 53: (1385) variable "_RC0" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16042) (warning)
../main.c: 54: (1385) variable "_RC1" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16044) (warning)
../main.c: 56: (1385) variable "_RC1" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16044) (warning)
../main.c: 69: (1385) variable "_RC0" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16042) (warning)
../main.c: 70: (1385) variable "_RC1" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16044) (warning)
../main.c: 72: (1385) variable "_RC1" is deprecated (declared at C:\Program Files (x86)\HI-TECH Software\PICC-18\9.80\include\pic18f4580.h:16044) (warning)
: 0: (499) undefined symbol:
_Send2LCD(Debug.obj)
Licensed for evaluation purposes only.
This licence will expire on Sat, 20 Jan 2018.
HI-TECH C Compiler for PIC18 MCUs (PRO Mode) V9.80
Copyright (C) 2011 Microchip Technology Inc.
Employing 18F4580 errata work-arounds:
* Corrupted fast interrupt shadow registers
(908) exit status = 1
make: *** [Debug.cof] Error 1

Error code 2
 
Last edited by a moderator:

Re: Does proteus support c language is there in way around it

There was a change in the headers some time back. You are using the old method. You have 2 options. Convert your code to the new method or #define _LEGACY_HEADERS to use the old.

New method for RC0 is PORTCbits.RC0 (or LATCbits.LATC0).

See https://www.edaboard.com/threads/285346/

Also, use #include <htc.h> rather than #include<pic18.h>
 

Re: Does proteus support c language is there in way around it

There was a change in the headers some time back. You are using the old method. You have 2 options. Convert your code to the new method or #define _LEGACY_HEADERS to use the old.

New method for RC0 is PORTCbits.RC0 (or LATCbits.LATC0).

See https://www.edaboard.com/threads/285346/

Also, use #include <htc.h> rather than #include<pic18.h>



thanks ...very logical explanation ...i am new to c and good in assmebly....i just copy paste and it looks like there outdates headers or some thing


i will try your modification and back to you soon

thanks for help am having more hope now
 

Re: Does proteus support c language is there in way around it

There was a change in the headers some time back. You are using the old method. You have 2 options. Convert your code to the new method or #define _LEGACY_HEADERS to use the old.

New method for RC0 is PORTCbits.RC0 (or LATCbits.LATC0).

See https://www.edaboard.com/threads/285346/

Also, use #include <htc.h> rather than #include<pic18.h>




i have added the #define _LEGACY_HEADERS


almost same type of failure ...occur.........would you please provide me with new code that rights to the lcd

using any pic ...preferably the PIC18F4580 or PIC16F887 also one important qyesuion do i have to know about the details of the pic in order to write to it or the c code is more or less "movable" from cpu to cpu
 

Re: Does proteus support c language is there in way around it

Convert your code to the new method.

New method for RC0 is PORTCbits.RC0 (or LATCbits.LATC0).

Use PORTCbits.RC0 for input and LATCbits.LATC0 for output

Also, the compiler is case-sensitive.

Code:
 Send2Lcd(0x84,"rhydoLABZ");  /* Displays string in the first line       */
 Send2LCD(0xc5,"Cochin");     /* Displays string in the second line

These calls are not the same and will cause the undefined symbol error.

Code:
: 0: (499) undefined symbol:
_Send2LCD(Debug.obj)
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
Re: Does proteus support c language is there in way around it

Convert your code to the new method.

New method for RC0 is PORTCbits.RC0 (or LATCbits.LATC0).

Use PORTCbits.RC0 for input and LATCbits.LATC0 for output

Also, the compiler is case-sensitive.

Code:
 Send2Lcd(0x84,"rhydoLABZ");  /* Displays string in the first line       */
 Send2LCD(0xc5,"Cochin");     /* Displays string in the second line

These calls are not the same and will cause the undefined symbol error.

Code:
: 0: (499) undefined symbol:
_Send2LCD(Debug.obj)





thanks it worked!!! i let the mcu thanks your forum he said "thanks edaboard" all i have done if to delete the line that have the capital

markings and it compiled ok

i would like to write more nice word to your forum ....some thing like moving text line from write to left ...

or let the mcu produce line after line like story telling ...any hints?
24067905_293753824363283_3889800998236193991_n.jpg
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top