Thanks Heirik and Acetronics2.
I will go on with your indications.
My antivirus does not allow to me to open the following :
http://www.picbasic.ru/_fr/3/LampDim.bas
Any possibility to have the files posted to me ?
Thanks,
Ambrogio
[email protected]
Thanks Heirik and Acetronics2.
I will go on with your indications.
My antivirus does not allow to me to open the following :
http://www.picbasic.ru/_fr/3/LampDim.bas
Any possibility to have the files posted to me ?
Thanks,
Ambrogio
[email protected]
Right click and save as ?
Dave
Always wear safety glasses while programming.
The problem is that my antivirus does not allow me to enter that link.
Thanks
Ambrogio
Will this work for you?
LampDim.bas
Dave
Always wear safety glasses while programming.
I have loaded the program as indicated .
No errors displayed.
I am using pbp 2.50, picf184523 @ 40 MHz speed.
I have a square wave output at porta.4 and 100 msec period ( 50 msec high and 50 msec low ).
Where does the 100 msec come from ?
How could I set different periods ?
The program is attached here.
Thanks
Ambrogio
'HSPLL OSCILLATOR HAS BEEN DEFINED IN THE PBP FOLDER > 18F4523 FILE
DEFINE OSC 40
LED1 VAR PORTA.4
INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = $31 ; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
Main:
PAUSE 1
GOTO Main
'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
>Where does the 100 msec come from ?
It comes from the formula ...
1/(OSC * 1000000 / 4 / Prescaler / 65536)
1/(40 * 1000000 / 4 / 8 / 65536) = 0.0524 Sec. = 52.4 mS
Times 2 for a full cycle = 104.8 mS
>How could I set different periods ?
If the frequency is fixed, use the Timer Template ...
http://darreltaylor.com/DT_INTS-14/TimerTemplate.html
DT
Do we just change these to their 18F counterparts for 18F PICs?
RobertINCLUDE "DT_INTS-14.bas"
INCLUDE "ReEnterPBP.bas'
Thanks Darrel for the assistance.
I red the pic18f4523 spec and I am just a little bit confused on how write and read the timer1 counter that is 16 bit long.
What is the picbasic code to read and write that 16 bit timer/counter ?
Your responses are always sharp an relly effective: congratulation.
Best regards,
Ambrogio
IW2FVO
IW2FVO,
To read the timer:
variable var word
variable = tmr1
To write the timer:
tmr1 = variable
Its just that simple....
Dave Purola,
N8NTA
EN82fn
thanks,
if I write tmr1= 64 then the compiler gives me :
>> error 113..... pbpp18.lib580 : symbol not previously defined (tmr1 ) and then the same message but lib588, lib927, lib 933.
So the point is still : how to read / write TMR1 ?
Any help is appreciated.
Thanks
Ambrogio
Bookmarks