Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

16f84a or 16f628 timer

Status
Not open for further replies.

fuq

Newbie level 3
Joined
Aug 31, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
Hello Everybody!
i want build a 16f84a or 16f628a timer
i want switch on an heater 5min and turn off 2hours.
but i don't know where start . :cry:
Please, Please help me
thanks
 

Hi,

You do not say if you know anything about what programming language or hardware you want to use, other than the pic chip.

You can Google for ready made timer projects or if you want to properly understand Pics then have a looks at this good practical Assembler tutorial using the 16F628A
http://www.winpicprog.co.uk/pic_tutorial.htm
 

    fuq

    Points: 2
    Helpful Answer Positive Rating
i am 0 :| in programming.
thanks for the beautyfull web can u give me another similar web? :D
 

Hi,
Here is the code (in mikroBASIC) using PIC16F84A:
Code:
program timer84EDA

symbol heater = PORTB.B0

const fivemin = 300000
const twohour = 7200000

main:
     TRISB = 0
     PORTB = 0
     heater = 0 'heater off
     delay_ms(fivemin) 'five minute delay
     heater = 1 'heater on
     delay_ms(twohour) 'two hour delay
     heater = 0 'heater off
     while true 'done
     wend
end.
Circuit:
31_1262629225.gif
 

    fuq

    Points: 2
    Helpful Answer Positive Rating
hi Tahmid
thans for circuit and hex.:D
 

Dear Tahmid,
I tried your codes in "rnikroElektronika Basic compiler for Microchip PIC microcontrollers Version: 7.0.0.2"

The codes are :
program timer84EDA

symbol heater = PORTB.B0

const fivemin = 300000
const twohour = 7200000

main:
TRISB = 0
PORTB = 0
heater = 0 'heater off
delay_ms(fivemin) 'five minute delay
heater = 1 'heater on
delay_ms(twohour) 'two hour delay
heater = 0 'heater off
while true 'done
wend
end.

But I get following error messages while building.
11:12 E-3 Identifier 'b0' was not declared timer84EDA.pbas
17:6 E-3 Identifier 'wend' was not declared timer84EDA.pbas
19:1 E-4 Syntax error: Expected '.' but '' found timer84EDA.pbas

Please Help

Subbudu
 

Hi,
Here is the code (in mikroBASIC) using PIC16F84A:
Code:
program timer84EDA

symbol heater = PORTB.B0

const fivemin = 300000
const twohour = 7200000

main:
     TRISB = 0
     PORTB = 0
     heater = 0 'heater off
     delay_ms(fivemin) 'five minute delay
     heater = 1 'heater on
     delay_ms(twohour) 'two hour delay
     heater = 0 'heater off
     while true 'done
     wend
end.
Dear Tahmid,
I tried your codes with some modification .
Code:
program 84Atimer
symbol ac1 = PORTB.B0
       ac2 = PORTB.B1
      led1 = PORTB.B2
      led2 = PORTB.B3

const onesec  = 60000
const threemin = 180000
const twohour = 7200000

sub procedure led1()
    led_Play(60000, 180000)                ' Frequency = 1Hz, duration = 3sec
end sub

sub procedure led2()
    led_Play(60000, 180000)                ' Frequency = 1Hz, duration = 3sec
end sub
main:
     TRISB = 0
     PORTB = 0
     ac1 = 0 'ac1 off
     delay_ms(twohour) 'five minute delay
     ac1 = 1 'ac1 on
     delay_ms(twohour) 'two hour delay
     ac1 = 0 'ac1 off
     while true 'done
     wend
     ac2 = 0 'ac1 off
     delay_ms(twohour) 'five minute delay
     ac2 = 1 'ac1 on
     delay_ms(twohour) 'two hour delay
     ac2 = 0 'ac1 off
     while true 'done
     wend
end.
but found error

error: 12 303 Identifier "led_Play" was not declared ac finale.mbas
error: 12 303 Identifier "led_Play" was not declared ac finale.mbas
error: 12 304 Syntax error: Expected "end" but "led_Play" found ac finale.mbas
error: 12 304 Syntax error: Expected "sub" but "(" found ac finale.mbas
error: 12 304 Syntax error: Expected "end" but "60000" found ac finale.mbas
error: 12 304 Syntax error: Expected "." but "," found ac finale.mbas
error: 0 102 Finished (with errors): 10 Jul 2011, 03:05:10 ac finale.mbppi


pl guide me , where i wrong ?
i hope u do it ...
 

Dear Tahmid,
I tried your codes in "rnikroElektronika Basic compiler for Microchip PIC microcontrollers Version: 7.0.0.2"

The codes are :
program timer84EDA

symbol heater = PORTB.B0

const fivemin = 300000
const twohour = 7200000

main:
TRISB = 0
PORTB = 0
heater = 0 'heater off
delay_ms(fivemin) 'five minute delay
heater = 1 'heater on
delay_ms(twohour) 'two hour delay
heater = 0 'heater off
while true 'done
wend
end.

But I get following error messages while building.
11:12 E-3 Identifier 'b0' was not declared timer84EDA.pbas
17:6 E-3 Identifier 'wend' was not declared timer84EDA.pbas
19:1 E-4 Syntax error: Expected '.' but '' found timer84EDA.pbas

Please Help

Subbudu

I know it's a year late, but maybe someone else will find it useful. I think I used mikroBASIC PRO for PIC.
In v7.0.0.2, write

Code ASM - [expand]
1
symbol heater = PORTB.0



---------- Post added at 13:25 ---------- Previous post was at 13:23 ----------

Dear Tahmid,
I tried your codes with some modification .

Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
program 84Atimer
symbol ac1 = PORTB.B0
       ac2 = PORTB.B1
      led1 = PORTB.B2
      led2 = PORTB.B3
 
const onesec  = 60000
const threemin = 180000
const twohour = 7200000
 
sub procedure led1()
    led_Play(60000, 180000)                ' Frequency = 1Hz, duration = 3sec
end sub
 
sub procedure led2()
    led_Play(60000, 180000)                ' Frequency = 1Hz, duration = 3sec
end sub
main:
     TRISB = 0
     PORTB = 0
     ac1 = 0 'ac1 off
     delay_ms(twohour) 'five minute delay
     ac1 = 1 'ac1 on
     delay_ms(twohour) 'two hour delay
     ac1 = 0 'ac1 off
     while true 'done
     wend
     ac2 = 0 'ac1 off
     delay_ms(twohour) 'five minute delay
     ac2 = 1 'ac1 on
     delay_ms(twohour) 'two hour delay
     ac2 = 0 'ac1 off
     while true 'done
     wend
end.


but found error

error: 12 303 Identifier "led_Play" was not declared ac finale.mbas
error: 12 303 Identifier "led_Play" was not declared ac finale.mbas
error: 12 304 Syntax error: Expected "end" but "led_Play" found ac finale.mbas
error: 12 304 Syntax error: Expected "sub" but "(" found ac finale.mbas
error: 12 304 Syntax error: Expected "end" but "60000" found ac finale.mbas
error: 12 304 Syntax error: Expected "." but "," found ac finale.mbas
error: 0 102 Finished (with errors): 10 Jul 2011, 03:05:10 ac finale.mbppi


pl guide me , where i wrong ?
i hope u do it ...

You called a function called led_play() but there is no function led_play() in your code. That's the error.

Hope this helps.
Tahmid.
 

my original requirement is ..
when power on
LED1_Blinking ,Frequency = 1Hz, duration = 3min
then
AC1_On ,2Hr
then
LED2_Blinking ,Frequency = 1Hz, duration = 3min
then
AC2_On ,2Hr
forever
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top