transforming 8051 to pic

Status
Not open for further replies.


In compiler uC what you use also the same must be used in Proteus.

Latest version of MikroC Pro for PIC is 6.0.0.

With real hardware I didnt notice any problem for now.

PIC18F46K22 is good and optimal choice for 40-dip case for lots of projects, also there is other uCs with higher number of pins, with more capabilities and features.



i did speed sensors & ADC, its working, thanx :smile:

I didnt understand this, what you mean under "speed sensors & ADC" ?




Best regards,
Peter

:wink:
 

1) so im using k20 for simulation purpose, cade can be transformed to k22 rit??

>means both are different, 1) external pulse counter & 2) ADC in 46k20 with GLCD, its working fine
 

1) so im using k20 for simulation purpose, cade can be transformed to k22 rit??

Yes of course, for real hardware you can change to PIC18F46K22 and recompile code.


>means both are different, 1) external pulse counter & 2) ADC in 46k20 with GLCD, its working fine

Ok. :smile:


Best regards,
Peter

:wink:
 


yes,new proteus having k22, but showing buggy glcd images, letters are showing fine, whenever i put box, or circle buggy images comes out.




- - - Updated - - -

1)with 18f4622k
2)with 18f46k20

- - - Updated - - -

1)with 18f4622k
2)with 18f46k20
 
Last edited:

Unfortunately, there is not much you can do to remedy the situation.

All simulators have their limitations, the more complex they are and the more complex the simulations, the higher the probability of issues.

Also, the mikroC compilers do not provide source code for their libraries, therefore there is no way to debug the library routines themselves.

Therefore, when mikroE makes changes to their libraries and issues arise, you have no choice but to either modify your code around the new libraries idiosyncrasies if possible or return to the previous version of the compiler.

The mikroC compilers are also not particularly compliant to the C89 and C99, C standards, which I've found to be quite irritating.

After decades of experience, I have found there are few, quick and easy shortcuts when developing code or designs for embedded systems.

My advice would be to write your own routines or use available third party source code, just as you did using the KEIL C Compilers.

Once you've developed your own routines you can then easily port them to different models of the same family of microcontrollers or entirely different families of microcontrollers for that matter.


Having the source code available of library routines you use is absolutely crucial!


BigDog
 
Reactions: tpetar

    tpetar

    Points: 2
    Helpful Answer Positive Rating
means i need to use, MPLAB IDE??
i tried with that, but that is not like keil, its having some difficulties, for a simple program i got lots of errors, i chosen mikroc
MPLAB IDE having lots of compilers, im confused with that,
and MicroC having good guide.
i think problem with proteus, so i've to try with hardware soon...
what say?
 

It's difficult to say with any certainty which is the source of the issue.


When coding for the PIC18 series, I prefer Hi-Tech's PICC18 or Microchip's C18 with the original MPLAB IDE.

Microchip purchased Hi-Tech a few years back and has begun incorporating Hi-Tech Compiler technology into new compiler releases.

Therefore, I've now began to migrate to the newer Microchip XC8 and the MPLAB X IDE.


Regardless of which compiler you prefer, I would still strong recommend you write your routines or utilize publicly available source.

Sooner or later, you will reach a point where issues cannot be resolved with access to the source code of the routines you have incorporated into your application.


What GLCD are you going to use when building the physical hardware design?

A KS0108 or T6963C controller based GLCD?


BigDog
 

now i try with MikroC, if its fails i have to create own routines,
may be KS0108, which is largely available in market.

is there any floating roundup calculation problem with pic??,
i need to calculate

Code:
x = (256*TMR0H + TMR0L);
temp=((0.0018)*x)/12;
temp1+=temp;

showing less numbers
 
Last edited by a moderator:

now i try with MikroC, if its fails i have to create own routines,
may be KS0108, which is largely available in market.

You may want to checkout the following library:

Universal C library for KS0108 based LCD displays

The site also offers several other library routines for other GLCD controller chipsets.

is there any floating roundup calculation problem with pic??,
i need to calculate
x = (256*TMR0H + TMR0L);
temp=((0.0018)*x)/12;
temp1+=temp;

showing less numbers


The majority of floating point standard implementations for microcontroller without an FPU are compiler dependent, not hardware dependent.

What is the difference between the expect value and the actual resulting value?

Post your entire code using CODE or SYNTAX tags, so that I can review it and make recommendations.


BigDog
 

in that library site, they not mentioned pic18??

Code:
/********************************wheel sensor*************************************/
  {
   T0CON.TMR0ON = 1;
   TMR0L = 0;
   TMR0H = 0;


   Delay_ms(500); // Wait for 1 sec

   T0CON.TMR0ON = 0;    // Stop the timer

   temp = (256*TMR0H + TMR0L);

   {
   temp1= (temp*2*6.732)/12; //used 12 magnets for 1 wheel rotation, wheel base is 1.88m and multiplied with kM/one hour reading ((60*60)/1000) finally 1.88*3.6=6.732
   speed_value[2] = (unsigned char) (temp1/100);
   speed_value[1] = (unsigned char) ((temp1/10)-(speed_value[2]*10));        // Find out second digit
   speed_value[0] = temp1-(speed_value[2]*100)-(speed_value[1]*10);

  
  
  if (temp1>99)
  {
  Glcd_Set_Font(Font_Glcd_Character8x7, 8, 7, 32);
  Glcd_Write_Char((speed_value[2]  + 48),2,2,1);
  Glcd_Write_Char( (speed_value[1] + 48),9,2,1);
  Glcd_Write_Char( (speed_value[0] + 48),16,2,1);
  }
  else
  {
  Glcd_Set_Font_Adv (Forgotten_Futurist12x19,1,0);

  temp4=temp1 ;
  Glcd_Write_Char_Adv( (speed_value[1] + 48),3,10);
  Glcd_Write_Char_Adv( (speed_value[0] + 48),16,10);
   }
  #endif
  }
  Glcd_Set_Font(Font_Glcd_System5x7, 5, 7, 32);
   temp2=((temp*(1.88/1000))/12);             //same, for 1 rotation 12 pulses, so total is temp2
   
   temp3=temp3+temp2;

   
   Digit[3]= (float) (temp3/100);
   EEPROM_Write(0x00,Digit[3]);
    Delay_ms(10);
   Digit[2]=(float)((temp3/10)-(Digit[3]*10));
   EEPROM_Write(0x01,Digit[2]);
    Delay_ms(10);
   y=(float) (temp3 - (Digit[3]*100)-(Digit[2]*10));
   Digit[1]=(char) y;
   EEPROM_Write(0x02,Digit[1]);
    Delay_ms(10);
   x=  y*10;
   Digit[0]=(char) (x -Digit[1]*10);
   EEPROM_Write(0x03,Digit[0]);
       Delay_ms(10);

  Glcd_Write_Char((Digit[3]  + 48),3,6,1);
  Glcd_Write_Char( (Digit[2] + 48),11,6,1);
  Glcd_Write_Char( (Digit[1] + 48),19,6,1);
  Glcd_Write_Text(".",26,6,1);
  Glcd_Write_Char( (Digit[0] + 48),34,6,1);
  }

this code i have used foe speed measurement & odo reading
result is, speed = 60 Km/h , duration 1 min. i need to get 1km in odometer
 

in that library site, they not mentioned pic18??

It certainly is not difficult to port their PIC16 source code to the PIC18 series.

It should not require more than 15 to 30 minutes of your time.


this code i have used foe speed measurement & odo reading
result is, speed = 60 Km/h , duration 1 min. i need to get 1km in odometer

Okay, later today I take a look and make some suggestions.

BigDog
 
ok, thank you :grin:
i need a perfect reading, becoz im replacing this project with my default speedometer of my motorbike,
im not ordering you, dont misunderstand :grin:
 

heyy,, i got , why its counting low, MCU will counts the value for only half second in one cycle, more instruction in between counting intervals , in that time i have to put some number to it
 

i bought PIC18f46k22 + GLCD + PICKIT2

i did hardware wiring on breadboard, connection is perfect, i checked lot of time,

when powered, nothing will show for some seconds,
after showing one line ugly image

What to do :?:



- - - Updated - - -

is there any problem with frequency?

written 20.0000 Mhz in mikroc, and PLL is switch off, selected HS highpower >16Mhz .

and im having JHD12864,
 

How about not transforming to a PIC processor, but instead just upgrade you 8051 processor?
I use the AT89C51RE2 (Atmel)

• 80C52 Compatible
– 8051 Instruction Compatible
– Four 8-bit I/O Ports (44 Pins Version)
– Three 16-bit Timer/Counters
– 256 bytes Scratch Pad RAM
– 11 Interrupt Sources With 4 Priority Levels
• ISP (In-System Programming) Using Standard VCC Power Supply
• Boot ROM Contains Serial Loader for In-System Programming
• High-speed Architecture up to 60 MHz
128K bytes On-chip Flash Program/Data Memory
On-chip 8192 bytes Expanded RAM (XRAM)
• Dual Data Pointer
Extended stack pointer to 512 bytes
• Improved X2 Mode with Independant Selection for CPU and Each Peripheral
• Keyboard Interrupt Interface on Port 1
• SPI Interface (Master/Slave Mode)
• Two Full Duplex Enhanced UART with Dedicated Internal Baud Rate Generator
• Hardware Watchdog Timer (One-time Enabled with Reset-Out), Power-Off Flag
• Power Control Modes: Idle Mode, Power-down Mode
• Power Supply: 2.7V to 5.5V
• Packages: PLCC44, VQFP44
 

now im doing with PIC, please solve my problem,, im not interested to go back again.
 

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…