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 10 years, 8 months 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

  • Droplet1 December 14, 2025
  • Bringing a Siemens W-48 and Ericsson Model 1951 back to life December 14, 2025
  • What is involved to convert a small town to fiber optic? December 14, 2025
  • mechanism to shutdown feeding when sensor temperature rises December 13, 2025
  • Oshonsoft MSSP simulation question December 13, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 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