Beginer problems


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Posts
    37


    Did you find this post helpful? Yes | No

    Default This is my code and schematics

    '************************************************* ********
    '
    ' LED FLASHING PROGRAM
    ' ======================
    '
    ' This program flashes an LED connected to port RB0 of PORTB. The
    ' LED is flashed with 1 second intervals.
    '************************************************* ************
    '
    LED VAR PORTB.0 ' Define RB0 as LED
    '
    ' START OF MAIN PROGRAM
    '
    TRISB = 0 ' Set PORTB pins as outputs
    AGAIN:
    LED = 1 ' Turn ON LED
    PAUSE 1000 ' Wait 1 second
    LED = 0 ' Turn OFF LED
    PAUSE 1000 ' Wait 1 second
    GOTO AGAIN ' Repeat forever
    END ' End of program
    Attached Images Attached Images  

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Lightbulb

    Ok Luxor

    Bingo : You simply forgot to write the chip A/D relevant registers config and define I/Os for your chip ...

    Code:
    DEFINE OSC 4             ' Default Osc freq
    DEFINE OSCCAL_1K 1   ' retrive the trimming value
    
    CMCON		= 7 ' disable Analog comparators
    
    GPIO 		= %00000000 'All pins LOW at startup
    
    TRISIO 		=%00101000  'set GPIO3 & GPIO5 as inputs
    so, add those lines to the top of code.

    AND do not forget to connect the RESET PIN ...

    a look to the 629 Datasheet will help !

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Jan 2010
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Thank you very much for your help

    I'l try as soon as possible.
    Thanks again.

  4. #4
    Join Date
    Jan 2010
    Posts
    37


    Did you find this post helpful? Yes | No

    Default At last, the project is finished

    I had many problem and brain damage because I used MPASM as assembler instead of PM.EXE (I used MicroCode Studio too). Simply line like
    Code:
    @ device  pic16F628, intrc_osc_noclkout
    gave me strange error codes...
    But now, the project is working. I hope somebody find it useful.
    Thanks all of you for help.

    Code:
    '************************************************* ********
    ' LED FLASHING PROGRAM
    ' ======================
    ' PIC16F628 20I/P
    ' Pic Basic Pro Compiler 2.45, (c) 1998, 2004 microEngineering Labs, Inc.
    ' Assembler used is PM.EXE, provided with microEngineering Labs PICBasic Compiler
    '
    ' This program flashes an LED connected to port RB0 of PORTB. The
    ' LED is flashed with 1 second intervals.
    '************************************************* ************
    '
    INCLUDE "modedefs.bas"
    '
    @ device  pic16F628, intrc_osc_noclkout; Use internal oscilator
    @ DEVICE pic16F628, MCLR_OFF ; Turn off internal reset (default) and leave RA.5 as an input
    '
    DEFINE OSC 4             ' Default Osc freq
    CMCON     = 7          ' PortA = digital I/O
    VRCON     = 0          ' A/D Voltage reference disabled
    TRISB     = %00000000  ' PORTB all pins outputs
    '
    ' Define RB0 as LED (pin number 6):
    LED VAR PORTB.0 
    ' VSS - pin number 5  (Ground)
    ' VDD - pin number 14 (+5V)
    ' MCLR (pin number 4) pulled-up to VDD by 4.7Ko resistor 
    '
    'program start
    AGAIN:
        LED = 1 ' Turn ON LED
        PAUSE 1000 ' Wait 1 second
        LED = 0 ' Turn OFF LED
        PAUSE 1000 ' Wait 1 second
        GOTO AGAIN ' Repeat forever
    END ' End of program

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi,Luxor

    I see on your listing you missed that :

    http://www.melabs.com/downloads/P245A1.EXE

    this is an official patch for your PBP 2.45 version ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Jan 2010
    Posts
    37


    Did you find this post helpful? Yes | No

    Default


    Thank you very much, Alan.

Similar Threads

  1. Problems with U2 programmer C30 compiled code
    By minimii in forum Off Topic
    Replies: 0
    Last Post: - 5th November 2009, 10:43
  2. Problems programming
    By Lionheart in forum General
    Replies: 4
    Last Post: - 7th December 2008, 17:51
  3. 2 PWM in 16F690 problems
    By ciendavila in forum mel PIC BASIC
    Replies: 9
    Last Post: - 27th April 2008, 10:03
  4. HSEROUT Problems
    By SergioRM in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th April 2005, 00:17
  5. USART problems
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 47
    Last Post: - 6th March 2005, 22:45

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