Microchip Tutorial


Posted on Feb 6, 2014

Look for the OSCCON register in the data sheet (as of this edit, page 19). This register, among other things, controls the speed of the internal clock. Upon startup, the processor runs at 31 kHz (way too slow. ) Using OSCCON, we can increase the speed to 8MHz. on reset all your pins are set to input (TRISB is set to high). So set TRISB low to do ou


Microchip Tutorial
Click here to download the full size of the above Circuit.

tput on a pin. *Can you add a breif description of what TRISB means Like you did for OSCCON above * Put the chip in the ZIF socket. Also make sure the hockey puck has the external 9V supply attached to it, otherwise the following steps will give you an error message about invalid device ID, and Vdd will be 0V instead of 5V. *Where is the 9V supply attached to * Then, on toolbar that appears: "Reset and connect to ICD" button *Where does this toolbar appear And what do you do with it Are we supposed to go into the MPLAB ICD 2 Setup Wizard * The internal PIC clock runs at whatever speed we set it to (via OSCCON register)-this frequency is denoted Fosc. The timers will tick one tick per instruction cycle. In the P18F1320 one instruction is executed every 4 clock ticks, so if our oscillator is at 8MHz (Fosc = 8MHz) then instructions will be executed at 2MHz. So, the timers will increment at 2MHz. If the timer is set up as 8-bit, the number you count up to can only go up to 256. If it is set up as 16-bit, you can count up to 65, 536. The subtraction will always work out correctly (even if the timer wraps around, which it will) if you cast the subtraction as an unsigned char (for 8-bit) or unsigned int (for 16-bit). This circuit turns on the LED when a magnet is held close to the Hall effect sensor, with either end (North or South) towards the hall effect sensor. The PIC reads in the analog voltage from the Hall effect sensor...




Leave Comment

characters left:

Related Circuits

  • New Circuits

    .

     


    Popular Circuits

    Miniature Black and White TV System
    Crystal display (LCD) tester
    Three-phase switch
    Signal injectoh-tracer
    Stabilized-wien-bridge-oscillator
    Inverter/Charger relay
    Mains Powered White LED Lamp
    DIY 6T9 Tube (Valve) Single-Ended Amplifier Kit
    avr usb slideshow presenter.
    Light Dimmer Circuit TRIAC dimmer circuitCircuitWorking
    SLAVE FLASH TRIGGER
    High-performance power supply LM334



    Top