EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Code translation to PIC18F452 in mikroC compiler

Code translation to PIC18F452 in mikroC compiler

|

Microcontroller › PIC › Code translation to PIC18F452 in mikroC compiler

  • This topic has 0 replies, 1 voice, and was last updated 11 years ago by Bahman Mohammadhoseini.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • April 15, 2015 at 6:53 am #3622
    Bahman Mohammadhoseini
    Participant
     

    Hello,everybody.Would you please tell me;

    1-What does mean the following ATmega16/AVR instructions?;

    ……..

    unsigned int k, h;

    DDRA=0x00;
     
    DDRD=0XFF;
     
    while (1)
    {
     
    k =~PINA;
     
    h=k & 0x0F;
     
    switch (h)
    {…..
     
    And what is the following ATmega16/AVR code translation to PIC18F452?;
     
    #include <mega16.h>
     
    void main(void)
    {
     
    unsigned int k, h;
     
    DDRA=0x00;
     
    DDRD=0XFF;
     
    while (1)
    {
     
    k =~PINA;
     
    h=k & 0x0F;
     
    switch (h)
    {
     
    case 0x02: 
    {
     
    PORTD=0x89;
     
    break;
     
    }
     
    case 0x08: 
    {
     
    PORTD=0x86; 
     
    break;
     
    }
     
    case 0x04:
    {
     
    PORTD=0x85; 
     
    break;
     
    }
     
    case 0x06:
     
    {
     
    PORTD=0x8A; 
     
    break;
     
    }
     
    case 0x05:
     
    {
     
    PORTD=0x00; 
     
    break;
     
    }
    }
    }
    }
     
                                                                                      Thanks,
     
     

     

  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Phone charger fix May 11, 2026
  • Phone Charger 5v to 12v May 11, 2026
  • Voltage comparator circuit verification May 10, 2026
  • What is this??? May 10, 2026
  • Why aren’t the power windows in my 2006 Volkswagen Polo 2006 working despite repairing the control unit circuit board? May 10, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise