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 / Help regarding writing hex file to PIC12F675

Help regarding writing hex file to PIC12F675

|

Microcontroller › PIC › Help regarding writing hex file to PIC12F675

  • This topic has 2 replies, 3 voices, and was last updated 8 years, 3 months ago by Ashutosh Bhatt.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 18, 2017 at 4:54 pm #4601
    Robosapien
    Participant

    I'm new to programming pic chips and I recently bought a pickit 2 clone to learn PIC microcontroller programming.

    I also downloaded the Pickit 2 software Application version 2.61.00, Device File version 1.61.00 and OS Firmware Version 2.32.00.

    The software seems to be working fine as I've noticed that it can detect whether the programmer is connected or not. and also, it detected my pic chip properly. Hence I'm sure the hardware connections are proper.

    I'm using a PIC12F675 8 pin microcontroller and am coding in assembly as it is easier for me to estimate the timings for the events required in my project.

    The Pickit 2 application has a window titled 'Program Memory' wherein i can see the hex values of the asm code in my hex file.

    When i select my hex file to be uploaded to the microcontroller, the 'Program Memory' window gets updated with the hex codes in the hex file. When i click on the button 'Write', the message window turns green and says 'Programming Sucessful'.

    But when i click on the Button that says 'Read', the message window turns green and says it finished reading and the all the values in the program window turns to zero (0000).

    The problem i am facing is that I am implementing a customised blink LED code but the LEDs in the circuit are not glowing, so I'm not sure if the program got uploaded properly.

    I have attached the asm code and the circuit diagram I'm using for my project.

    #include p12f675.inc
     __CONFIG _FOSC_INTRCIO & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _BOREN_ON & _CP_ON & _CPD_ON
    RES_VECT  CODE    0x0000            ; processor reset vector
        GOTO    START                   ; go to beginning of program
    MAIN_PROG CODE                      ; let linker place main program

    START

        banksel TRISIO
        clrf TRISIO        ;tris10
        clrf INTCON        ;intcon
        clrf IOC        ;ioc
        clrf ANSEL        ;ansel
        movlw B'11011111'
        movwf OPTION_REG
        banksel GPIO
        movwf GPIO
        
        banksel GPIO
        comf GPIO
        movlw H'20'
        movwf H'0020'
        decfsz H'0020'
        goto $+2
        goto $-6
        movlw H'20'
        movwf H'0021'
        decfsz H'0021'
        goto $+2
        goto $-7
        movlw H'20'
        movwf H'0022'
        decfsz H'0022'
        goto $-1
        goto $-7
        END

     

    Basically, my idea is to have all the GPIO pins toggle after a specified time interval.

    And here is my the circuit diagram I'm using.I've connected 2 LEDs in series to reduce the voltage on each LED. 3V is the rated Voltage for a single LED, but it glows just a little dim when supplied 2.5V directly. But when connected in this circuit, it dosent glow at all. I tried powering the LEDs from pin 6, 7 and 3 but none of them make the LEDs glow.

    So, where am i going wrong? is my code improper? or is any configuration bit setup improperly or is the code not getting uploaded?

    Thanks in advance.

    January 19, 2017 at 8:37 am #14350
    GANEEV SINGH
    Participant

    Hi there

    I am not sure about PIC microcontrollers but I will suggest you to try out this code on a simulator like Proteus or something similar. It will help you detect problem in code, in any.

    Such simulators are really helpful if you want to debug something or if want to see how your project works.

    You will get Proteus software online easily.

    January 25, 2017 at 7:09 pm #14371
    Ashutosh Bhatt
    Participant

    no one uses assembly language now a day

    just switch over to embedded C language

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

RSS Recent Posts

  • Need Help Figuring Out the Schematics Of Circuit Board May 13, 2025
  • Wish to buy Battery, Charger and Buck converter for 12V , 2A router May 12, 2025
  • applying solder paste from a jar May 12, 2025
  • Question i-nears headphones magnetic drivers May 12, 2025
  • An Update On Tarrifs May 12, 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