hi,
Some assemblers will accept upper or lower case text, some have to be set to accept upper or lower.
I would recommend that you use lower case for the PIC instructions and upper case for the SFR names, this IMO makes it easier to read.
If you have a spare output pin, you could use it to drive a 'brake/holding' solenoid, so that the solar panel can resist the wind trying to move it.
In that way you could remove the brake and drive the servo every 5 minutes and apply the hold.
Its possible to count a 5min delay period and at the same time activate the servo.
list p=16f88
#include <pic16f88.inc>
OSCCON equ 0x8F
STATUS equ 0x03
PORTA equ 0x05
PORTB equ 0x06
ANSEL equ 0x9B
TRISA equ 0x85
TRISB equ 0x86
d1 equ 0x20
d2 equ 0x21
d3 equ 0x22
;cblock 0x20
;d1
;d2
;d3
;endc
org 0x00
main ;main loop
;********setting the internal RC clock frequency
call banksel1
movlw 0x6E ;freq = 4MHz, bit 1 and 0 are 10 because internal RC is used for the system clock
movwf OSCCON
movlw 0x00
movwf ANSEL ;setting all pins to digital pins
clrf TRISA ;setting all port A into output
clrf TRISB ;setting all port B into output
call banksel0
clrf PORTA;set all port A into LOW
clrf PORTB;set all port B into LOW
main_loop
;move to neutral***
bsf PORTA,0 ;set pin 17 HIGH
call delay1.5ms
bcf PORTA,0 ;set pin 17 LOW
call delay18.5ms
call delay60s
goto main_loop
goto main
;***bank selections***
banksel0
bcf STATUS,5
bcf STATUS,6
return
banksel1
bsf STATUS,5
bcf STATUS,6
return
delay1.5ms ;total of 1,500 cycles
movlw 0x2B
movwf d1
movlw 0x02
movwf d2
goto delay_m
return
delay18.5ms ;total of 18,500 cycles
movlw 0x73
movwf d1
movlw 0x0F
movwf d2
goto delay_m
return
delay60s ;total of 6,000,000 cycles
movlw 0x23
movwf d1
movlw 0xCB
movwf d2
movlw 0x83
movwf d3
goto delay_big
return
;*actual delay routine
delay_m
decfsz d1,f
goto $+2
decfsz d2,f
goto delay_m
return
delay_big
decfsz d1,f
goto $+2
decfsz d2,f
goto $+2
decfsz d3,f
goto delay_big
goto $+1
goto $+1
return
Warning[205] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 2 : Found directive in column 1. (list)
Error[105] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 3 : Cannot open file (Include File "pic16f88.inc" not found)
Warning[205] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 23 : Found directive in column 1. (org)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 28 : Found opcode in column 1. (call)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 29 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 30 : Found opcode in column 1. (movwf)
Message[302] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 30 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 32 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 33 : Found opcode in column 1. (movwf)
Message[302] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 33 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 34 : Found opcode in column 1. (clrf)
Message[302] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 34 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 35 : Found opcode in column 1. (clrf)
Message[302] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 35 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 37 : Found opcode in column 1. (call)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 38 : Found opcode in column 1. (clrf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 39 : Found opcode in column 1. (clrf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 44 : Found opcode in column 1. (bsf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 45 : Found opcode in column 1. (call)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 46 : Found opcode in column 1. (bcf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 47 : Found opcode in column 1. (call)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 49 : Found opcode in column 1. (call)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 51 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 53 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 58 : Found opcode in column 1. (bcf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 59 : Found opcode in column 1. (bcf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 60 : Found opcode in column 1. (return)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 63 : Found opcode in column 1. (bsf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 64 : Found opcode in column 1. (bcf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 65 : Found opcode in column 1. (return)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 68 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 69 : Found opcode in column 1. (movwf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 70 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 71 : Found opcode in column 1. (movwf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 72 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 73 : Found opcode in column 1. (return)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 76 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 77 : Found opcode in column 1. (movwf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 78 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 79 : Found opcode in column 1. (movwf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 80 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 81 : Found opcode in column 1. (return)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 84 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 85 : Found opcode in column 1. (movwf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 86 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 87 : Found opcode in column 1. (movwf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 88 : Found opcode in column 1. (movlw)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 89 : Found opcode in column 1. (movwf)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 90 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 91 : Found opcode in column 1. (return)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 95 : Found opcode in column 1. (decfsz)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 96 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 97 : Found opcode in column 1. (decfsz)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 98 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 99 : Found opcode in column 1. (return)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 102 : Found opcode in column 1. (decfsz)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 103 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 104 : Found opcode in column 1. (decfsz)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 105 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 106 : Found opcode in column 1. (decfsz)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 107 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 108 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 109 : Found opcode in column 1. (goto)
Warning[203] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 110 : Found opcode in column 1. (return)
Error[129] G:\FYP\MOTOR\TEST\PIC TESTING.ASM 111 : Expected (END)
mplab is a spoiled kid, needs to be ended after subroutine. thank you for reading this. do come back time to time though, I will surely have some other questions.
regards.
list p=16f88 ; list directive to define processor
#include <p16F88.inc> ; processor specific variable definitions
errorlevel -302 , -207 ; suppress messages 302 [Bank] and 207 [label in column 1]
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
alright, I just tried it....
my MPLAB requires any hexadecimal number to be written in 0x...
and about the #include error, I just deleted it because it caused error even with the addition lines. The addition lines showed up in the error as well.
I just hope that thing will work well without #include thingy....
Thank you.
Regards.
list p=16f88
#include <pic16f88.inc>
OSCCON equ 0x8F
STATUS equ 0x03
PORTA equ 0x05
PORTB equ 0x06
ANSEL equ 0x9B
TRISA equ 0x85
TRISB equ 0x86
d1 equ 0x20
d2 equ 0x21
d3 equ 0x22
;cblock 0x20
;d1
;d2
;d3
;endc
org 0x00
main ;main loop
;********setting the internal RC clock frequency
call banksel1
movlw 0x6E ;freq = 4MHz, bit 1 and 0 are 10 because internal RC is used for the system clock
movwf OSCCON
movlw 0x00
movwf ANSEL ;setting all pins to digital pins
clrf TRISA ;setting all port A into output
clrf TRISB ;setting all port B into output
call banksel0
clrf PORTA ;set all port A into LOW
clrf PORTB ;set all port B into LOW
main_loop
;move to neutral***
bsf PORTA,0 ;set pin 17 HIGH
call delay1.5ms
bcf PORTA,0 ;set pin 17 LOW
call delay18.5ms
call delay60s
goto main_loop
goto main
;***bank selections***
banksel0
bcf STATUS,5
bcf STATUS,6
return
banksel1
bsf STATUS,5
bcf STATUS,6
return
delay1.5ms ;total of 1,500 cycles
movlw 0x2B
movwf d1
movlw 0x02
movwf d2
goto delay_m
return
delay18.5ms ;total of 18,500 cycles
movlw 0x73
movwf d1
movlw 0x0F
movwf d2
goto delay_m
return
delay60s ;total of 6,000,000 cycles
movlw 0x23
movwf d1
movlw 0xCB
movwf d2
movlw 0x83
movwf d3
goto delay_big
return
;*actual delay routine
delay_m
decfsz d1,f
goto $+2
decfsz d2,f
goto delay_m
return
delay_big
decfsz d1,f
goto $+2
decfsz d2,f
goto $+2
decfsz d3,f
goto delay_big
goto $+1
goto $+1
return
alright, I just tried it....
my MPLAB requires any hexadecimal number to be written in 0x...
and about the #include error, I just deleted it because it caused error even with the addition lines. The addition lines showed up in the error as well.
I just hope that thing will work well without #include thingy....
Thank you.
Regards.
oh damn, you're right, the file does not exist.
I just downloaded it from melabs.com. Where should I put this file in?
Thanks/
Regards.
I think the one that I just downloaded is a different include file. damn, why didn't they just put in the installer. -.-'
Thank you for your help, mr eric.
Regards.
bit 4, 1-0 FOSC<2:0>: Oscillator Selection bits
111 = EXTRC oscillator; CLKO function on RA6/OSC2/CLKO
110 = EXTRC oscillator; port I/O function on RA6/OSC2/CLKO
101 = INTRC oscillator; CLKO function on RA6/OSC2/CLKO pin and port I/O function on RA7/OSC1/CLKI pin
100 = INTRC oscillator; port I/O function on both RA6/OSC2/CLKO pin and RA7/OSC1/CLKI pin
011 = ECIO; port I/O function on RA6/OSC2/CLKO
010 = HS oscillator
001 = XT oscillator
000 = LP oscillator
I changed the extension into .inc, but it still is in text file. -.-
gonna bang my head on the wall.
Regards.
whoops, I'm using MPLAB v8.6, I've said that before my last post. sorry about it...
would you mind explaining how to access the CONFIG1 register? in which bank is it located?
Thank you.
Regards
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?