transforming 8051 to pic

Status
Not open for further replies.

ltsharma

Advanced Member level 4
Joined
May 26, 2013
Messages
110
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,306
Location
banglore
Visit site
Activity points
2,003
i've done a project motorbike Display system using 8051 based P89V51RD2 (NXP) chip, code HEX reached >30K, 1K ram is full (no space to add even one variable), i cant interface more devices like GLCD, RTC and all.
BTW i heard PIC is robust than 8051, which pic is better to do this project??.. for 8051 (code is 30K, & RAM is 1K) is full,, i need to add more peripherals to my project,,,
 

I'd recommend the PIC24 family. Lots of features. Which series (24F, 24H, etc) depends on what you're looking for-performance, low power, etc.
 

i need this for automobile (motorbike) purpose, to interface I2c>RTC&EPROM, GLCD, ADC (its inbuilt in pic rit)..........
 

I'd recommend the PIC24 family.
I agree. Flash and RAM size is scalable to application requirements over a large range, small devices are only slightly more expensive than PIC16 or PIC18 devices with similar parameters. Nevertheless, there's a lot of other processors to be considered too, particularly various ARM chips.
 


See this uC, for my thinking this is best buy for lots projects, price is around 2,5-3USD. Of course TQFP case for final project, DIP40 for developing.

PIC18F46K22
Program memory size 64KB
RAM size 3896 bytes
EEPROM size 1024 bytes
ADC 10-bit 28 channels
Voltage 1,8V-5,5V

https://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en547757


PIC24, PIC32, ARM are good and they are next step for various projects where you need more ports, speed, ....


Best regards,
Peter

- - - Updated - - -



What compiler you using ?

Look to use C compiler and check code optimization options.
 
Last edited:
wowwww,,, this is bang............ but what about programming, i know oly 8051 C programming, what will be the difference? , where to learn? which compiler is better???
 

but what about programming, i know oly 8051 C programming, what will be the difference?
Part of the 8051 code will be device specific and has to be ported to the new processor, particular hardware-specific stuff. How much work is involved depends, is it written in a portable way yet, using function calls or macros to access the hardware.
 
Reactions: tpetar

    tpetar

    Points: 2
    Helpful Answer Positive Rating
and also i know little bit about pic16f877,,, i can write program to 877,, what is difference b/w pic16f877 & PIC18F46K22....
 

Not much some register change which can change easily by reading datasheet. So u start some small application such as LED blinking Reading ADC then go to final project which give u best understanding of PIC u may use demo software of Hi-Tech or CCS compiler which is easily available on concern web page.
 
is every compiler having 2k limit or any demo limits??... mine reaches more than 30Kb
 

If you've got a demo compiler, then yes, it might have limits. But that doesn't mean that "every compiler" has that limit. The free compiler that comes with Microchip's MPLAB supports all their chips.
 

what about mikroC pro, but that has some 2k limit,,,,, and it has inbuilt macros rit, means writeDtataToLCD() like this
 


is mikroC's library can be used with MPLAB????, im feeling some difficulties with PIC compared to 8051
 

is mikroC's library can be used with MPLAB????, im feeling some difficulties with PIC compared to 8051

No, MikroC Pro libraries are for MikroE compilers. MikroC, MikroPascal and MikroBasic exist for other platforms AVR,ARM,8051,PIC,PIC32,dsPIC/PIC24.

MikroE have huge numbers of available libraries for offered compilers, this make programming job easier. Lots of third-party and official libraries can be found on www.libstock.com

If you use MikroC on some platform you can easily migrate to other platform, but particular hardware features and options must be respected.

Best regards,
Peter
 
Now, im having avery code in C for PIC16F877, i need more ram so im planning to go to what u told PIC18F46K22,,, what are all need to be changed can u explain,

with this code ???

Code:
#include "Includes.h"

// Configuration word for PIC16F877
__CONFIG( FOSC_HS & WDTE_OFF & PWRTE_ON & CP_OFF & BOREN_ON 
                & LVP_OFF & CPD_OFF & WRT_ON & DEBUG_OFF);

// Main Function
void main(void)
{
        unsigned int ADC_value = 0;
        unsigned int digit1, digit2, digit3, digit4;

        InitADC();                        // Initialize ADC
        InitLCD();                        // Initialize LCD

        while(1)
        {
                ClearLCDScreen();                                        // Clear LCD screen
                ADC_value = GetADCValue(AN7);                // Read ADC value from RE2(AN7) pin

                // ADC_value can have a value from 0 (0v) to 1023(5v) only.
                // SO display 4 digits of ADC_value
                digit1 = (unsigned int)(ADC_value/1000);                                                                         // Calculate digit1 of ADC_value
                digit2 = (unsigned int)((ADC_value - digit1*1000)/100);                                                 // Calculate digit2 of ADC_value
                digit3 = (unsigned int)((ADC_value - (digit1*1000+digit2*100))/10);                         // Calculate digit3 of ADC_value
                digit4 = (unsigned int)(ADC_value - (digit1*1000+digit2*100+digit3*10));         // Calculate digit4 of ADC_value

                WriteDataToLCD(digit1+0x30);                // Display digit1 of ADC_value on LCD
                WriteDataToLCD(digit2+0x30);                // Display digit2 of ADC_value on LCD
                WriteDataToLCD(digit3+0x30);                // Display digit3 of ADC_value on LCD
                WriteDataToLCD(digit4+0x30);                // Display digit4 of ADC_value on LCD

                __delay_ms(500);                                        // Half second delay before next reading
        }
}
 

1) is PIC18F46K20 can be used for simulation???, is there any differences??... Proteus don't having K22

2) is PIC18F can be flashed using serial port????.. or requires new programmer?????????

3) im using mikroC pro, not basic pro is there any differences???

4) is there any changes by increasing crystal frequency?
 
Last edited:



Answers on numerated questions :

1. Yes it can. This uC is little lighter then PIC18F46K22 for numbers of ADC pins, CCP, ECCP, timers, cap touch channels.

2. Yes you can use it In-Circuit Serial Programming™ (ICSP™) via two pins.

3. Good choice, MikroC can revive chip in full capacity and with all capabilities and good optimization of program size. MikroBasic in other hand offer easier programming for beginners.

4. No. All works up to 64MHz (4xPLL).



But you should know that PIC18F46K20 have different working voltage :

Operating Voltage Range: 1.8V to 3.6V



PIC18F46K20 informations :
https://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en026331

PIC18F46K22
informations :
https://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en547757




Best regards,
Peter
 
OK,,, thanx a lot.........................
is there any other option to simulate 46K22??? or any addons for proteus??

i did that ADC programm,, but protuse not giving OP
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…