Would you like to look what is wrong?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Location
    New York US
    Posts
    46

    Question Would you like to look what is wrong?

    Have Micro Studio Plus ver. 3.005
    PIC Basic Pro Compiler ver 2.5
    MPASM assembler
    Programmer USB K150 from kitrus.
    Wrote simple testing program for P16F84A 20Mhz and program Pic.
    Unfortunately Pic does not respond to switch and did nothing.
    I really need your help to make my system ready to use.
    I think that may be something missing in my testing program and problem is not in software or hardware.
    Below is my testing program:
    __________________________________________________ __________
    '************************************************* ***************
    '* Name : Circulator.BAS *
    '* Author : [] *
    '* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 10/25/2008 *
    '* Version : 1.0 *
    '* Notes : Create round circulation of 6 LEDs
    '* : in different sequences
    '************************************************* ***************
    'Pic16F84A This program used combinationpins PortA0 - PortA.4
    'to change state of pins PortB.0 - PortB.7 for output
    'Order 1 PortA.0 = 0 stop program
    '2 change code PortA.1 - PortA.4 get info from buttons
    '3 PortA.0 = 1 run program
    'PBP -p16f84a circulator
    DEFINE OSC 20
    define __CONFIG _CP_OFF&_WDT_OFF&_BODEN_OFF&_PWRTE_ON
    INCLUDE "modedefs.bas"
    TRISA = %00011111
    TRISB = %00000000
    POKE PORTB,00
    myvar var byte
    youvar var byte
    coils con %00111111
    SERIND var PORTB.6
    SERLED var PORTB.7
    OPTION_REG = %10000000
    INTCON = %00000000
    main:
    PEEK PORTA & $1F, myvar
    youvar = NCD myvar
    if youvar = 0 then gosub sStop
    if youvar = 1 then gosub sRun
    goto main
    sStop:
    POKE PORTB,%00000000
    serout SERLED,N9600,[154,1] 'clear and move to home position
    serout SERLED,N9600,["Stop"] 'type on first line Working
    return
    sRun:
    POKE PORTB,coils
    pulsout SERIND,100
    serout SERLED,N9600,[154,1] 'clear and move to home position
    serout SERLED,N9600,["Working"] 'type on first line Working
    serout SERLED,N9600,[254,192] 'send cursor to second line
    serout SERLED,N9600,[youvar] 'type value
    return
    end 'Success
    _________________________________________________
    Best Regards

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If you are making a test program to check you setup, start with making an LED blink and build from there.

    Then you will know it it is the programmer or some other problem.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by hardcore View Post
    Have Micro Studio Plus ver. 3.005
    PIC Basic Pro Compiler ver 2.5
    MPASM assembler
    Programmer USB K150 from kitrus.
    Wrote simple testing program for P16F84A 20Mhz and program Pic.
    Unfortunately Pic does not respond to switch and did nothing.
    I really need your help to make my system ready to use.
    I think that may be something missing in my testing program and problem is not in software or hardware.
    Below is my testing program:
    __________________________________________________ __________
    '************************************************* ***************
    '* Name : Circulator.BAS *
    '* Author : [] *
    '* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 10/25/2008 *
    '* Version : 1.0 *
    '* Notes : Create round circulation of 6 LEDs
    '* : in different sequences
    '************************************************* ***************
    'Pic16F84A This program used combinationpins PortA0 - PortA.4
    'to change state of pins PortB.0 - PortB.7 for output
    'Order 1 PortA.0 = 0 stop program
    '2 change code PortA.1 - PortA.4 get info from buttons
    '3 PortA.0 = 1 run program
    'PBP -p16f84a circulator
    DEFINE OSC 20
    define __CONFIG _CP_OFF&_WDT_OFF&_BODEN_OFF&_PWRTE_ON
    INCLUDE "modedefs.bas"
    TRISA = %00011111
    TRISB = %00000000
    POKE PORTB,00
    myvar var byte
    youvar var byte
    coils con %00111111
    SERIND var PORTB.6
    SERLED var PORTB.7
    OPTION_REG = %10000000
    INTCON = %00000000
    main:
    PEEK PORTA & $1F, myvar
    youvar = NCD myvar
    if youvar = 0 then gosub sStop
    if youvar = 1 then gosub sRun
    goto main
    sStop:
    POKE PORTB,%00000000
    serout SERLED,N9600,[154,1] 'clear and move to home position
    serout SERLED,N9600,["Stop"] 'type on first line Working
    return
    sRun:
    POKE PORTB,coils
    pulsout SERIND,100
    serout SERLED,N9600,[154,1] 'clear and move to home position
    serout SERLED,N9600,["Working"] 'type on first line Working
    serout SERLED,N9600,[254,192] 'send cursor to second line
    serout SERLED,N9600,[youvar] 'type value
    return
    end 'Success
    _________________________________________________
    Best Regards
    Yep, I do see something wrong.
    define __CONFIG _CP_OFF&_WDT_OFF&_BODEN_OFF&_PWRTE_ON is incorrect. Replace the lowercase define with @ and add spaces before &. All those peeks and pokes tells me you are transistioning from basic stamps. The error in your config statement caused it to be ignored by mpasm, so it would use the default config, which you have likely have commented out, if you have not commented it out you will see a compiler error, complaining. Try @__CONFIG _HS_OSC & _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON ,mind you I am not using my own computer right now, so I am unable to verify the validity of my example code, it is based solely on your code.
    Last edited by Archangel; - 2nd December 2008 at 20:37.
    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.

  4. #4
    Join Date
    Dec 2008
    Location
    New York US
    Posts
    46


    Did you find this post helpful? Yes | No

    Wink Thank you for advice

    I found better way by using PIC simulating software.
    ________________________________________
    To Whom Who study taxes:
    Communism is 100% taxes and NO salaries
    Socialism is 75% taxes and small salaries
    Capitalism is 25% taxes and salary that you deserve
    Crime Society is 0% taxes and full salary and too much blood

Similar Threads

  1. LCD Showes Some Wrong Letters
    By sbobowski in forum General
    Replies: 2
    Last Post: - 23rd September 2008, 19:15
  2. Anyone know whats wrong with this code
    By Bonxy in forum Serial
    Replies: 10
    Last Post: - 9th March 2007, 16:29
  3. ADCIN - AD settings are wrong
    By teverett in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th December 2006, 16:32
  4. What am I doing wrong?
    By mankan in forum General
    Replies: 1
    Last Post: - 23rd June 2006, 19:03
  5. HDD IDE ATA 2 interface problems. code wrong?
    By rastan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th March 2005, 16:01

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