PDA

View Full Version : Would you like to look what is wrong?



hardcore
- 2nd December 2008, 16:05
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

mackrackit
- 2nd December 2008, 18:06
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.

Archangel
- 2nd December 2008, 20:29
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 RegardsYep, 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.

hardcore
- 3rd December 2008, 16:51
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