Help with code, settings


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2007
    Posts
    48

    Default Help with code, settings

    I cant get this code to work with my PIC16F887 :/

    Code:
    @   device  pic16F887, hs_osc, wdt_off, mclr_on, lvp_off, protect_off
    DEFINE OSC 20
    
    loop: 
    
    high portb.2
    pause 500
    low portb.2
    pause 500
    goto loop
    end
    Im not 100% sure if this is right, is it?

    Code:
    @   device  pic16F887, hs_osc, wdt_off, mclr_on, lvp_off, protect_off

  2. #2
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    If you are are using MPSAM and you have the correct chip selected in MCS then try

    Code:
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON
    and then add then line
    Code:
    DEFINE OSC 20
    See if that works

  3. #3
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Question

    is it not compiling correctly or is it that portb.2 isn't toggling in your circuit?

    if it's that it's not working in your circuit, it could be a couple of things; no pull-up resistor on MCLR, oscillator not correct or not functioning correctly (capacitors), RB.2 not set to digital or not set to an output

    Cheers

    Rob

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xobx View Post
    I cant get this code to work with my PIC16F887 :/

    Code:
    @   device  pic16F887, hs_osc, wdt_off, mclr_on, lvp_off, protect_off
    DEFINE OSC 20
    
    loop: 
    
    high portb.2
    pause 500
    low portb.2
    pause 500
    goto loop
    end
    Im not 100% sure if this is right, is it?

    Code:
    @   device  pic16F887, hs_osc, wdt_off, mclr_on, lvp_off, protect_off
    For PM assembler use:
    Code:
    @ DEVICE  PIC16F887, HS_OSC
    @ DEVICE  PIC16F887, WDT_OFF
    @ DEVICE  PIC16F887, MCLR_ON
    @ DEVICE  PIC16F887, LVP_OFF
    @ DEVICE  PIC16F887, PROTECT_OFF
    For MPASM use:
    Code:
    @ __config _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF & MCLR_ON, & PROTECT_OFF
    SEE THIS THREAD: http://www.picbasic.co.uk/forum/show...iguration+fuse
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5


    Did you find this post helpful? Yes | No

    Default Using a bootloader??

    If you are using a bootloader you need something like

    DEFINE Loader_Used 1


    near the top of your program

    HTH
    Brian

Similar Threads

  1. Simple LCD code not working!...WHY?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th November 2009, 19:48
  2. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  3. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  4. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  5. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26

Members who have read this thread : 1

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