Beginner- blinking led's on pickit 2 starter kit


Results 1 to 24 of 24

Threaded View

  1. #12
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Beginner- blinking led's on pickit 2 starter kit

    I have never used MPlab... BUT I do know that the free version of MicroCodeStudio does support the 16F690.

    You are correct that the pickit software imports HEX code. So you write your software in the MCS environment. Compile using PBP and then import the hex into the pickit software and program your pic.

    I (and others) can help you get MCS (free version) up and running, not much to it really. Other than pointing it to PBP for the compiler.

    I then just goto the pickit window and manually import the hex file and program.

    That is about all I know to help you with. No experience with MPlab here.

    ---------------------------

    Below is a snippit of code showing how to set the configuration fuses from within your program. look toward the top for the line that begins with @.

    Also lower down you will see several configuration registers and some typical settings with comments to explain.

    Code:
    ' 16F690 '**************************************************************** '* Name : UNTITLED.BAS * '* Author : [select VIEW...EDITOR OPTIONS] * '* Notice : Copyright (c) 2007 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 11/25/2007 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** @ device pic16F690, intrc_osc_noclkout, BOD_OFF, PWRT_OFF, wdt_off, mclr_off,protect_off
    INCLUDE
    "Temp_Convert_CtoFonly.pbp"
    ' -----[ I/O Definitions ]------------------------------------------
    ' DEFINE DEBUG_REGG PORTA 'set debug port to porta ' DEFINE DEBUG_BIT 0 'use pin a0 of porta for debug
    ' DEFINE DEBUG_BAUD 2400 'set baud rate to 2400 ' DEFINE DEBUG_MODE 0 'communicate in true mode ' DEFINE DEBUGIN_BIT 1 'use pin a0 of porta for debug ' -----[ Variables ]------------------------------------------------
    x88 VAR BYTE[9] 'array to hold the 8 column bytes
    msg VAR BYTE[30] 'array to hold current message col VAR BYTE 'byte to hold fetched coulmn row VAR BYTE 'byte to hold current row being scanned via walking "1" r VAR BYTE 'row counter i VAR BYTE 'col counter char VAR BYTE 'current character to fetch view VAR BYTE 'delay to allow eye to see ltr VAR BYTE 'number of letters in current message pos VAR BYTE 'scrolling column counter len VAR BYTE 'length of current char or msg being scrolled now VAR BYTE 'holds current position for storing data to matrix pix VAR BYTE done VAR BYTE car VAR BYTE ' holds position of car, "0" is the car crash VAR BYTE speed VAR BYTE ' scrolling speed, lower is faster BtnTmr VAR BYTE 'counter for decreminging LOn VAR WORD 'time for leds to be on LOff VAR WORD 'time for leds to be off wface VAR BYTE mode VAR BYTE C VAR WORD ; Celsius also used as Car race Lap counter F VAR WORD ; Fahrenheit '-------------[variables and constants for temperature routine]-------------- DS18B20_9bit CON %00011111 ' set resolution on DS18B20 93.75ms, 0.5°C Comm_Pin VAR PortA.4 ' One-wire Data-Pin "DQ" on PortA.4 Busy VAR BIT ' Busy Status-Bit Raw VAR WORD ' RAW Temperature readings TempF VAR WORD ' Temp in deg F Cold_Bit VAR Raw.BIT11' Sign-Bit for +/- Temp. 1 = Below 0 deg C Real_Cold CON 1 ' Define Real_Cold = 1 Sign VAR BYTE ' +/- sign for temp display
    ' -----[ Initialization ]--------------------------------------------
    Reset:
    TrisA = %00011000
    'Port A3,A4 inupts rest outputs (A3 cannot output) TrisB = %00000000 'Port B all outputs TrisC = %00000000 'Port C all outputs ansel = 0 'and turn off analog AnselH = 0 'turn of rest of analogs CM1CON0 = 0 'turn off comparators CM2CON0 = 0 'turn off comparators SSPCON.BIT5 = 0 ' disable serial port, pins are I/O OPTION_REG = %10000000 '1 turn off weak pull ups INTCON = %00000000
    ' -----[starting Constants ]------------------------------------------------

    Last edited by Heckler; - 21st June 2011 at 20:38. Reason: formatting corrections
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts