TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139257 times)
  2. FAT32 Library (71751 times)
  3. Network Ethernet Library (57123 times)
  4. USB Device Library (47430 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42404 times)
  7. GSM click (29835 times)
  8. mikroSDK (28078 times)
  9. PID Library (26885 times)
  10. microSD click (26198 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Project

Programmable Timer

Rating:

4

Author: Vladimir Djukovic

Last Updated: 2014-05-20

Package Version: 1.0.0.0

Category: Timers (Real time clock)

Downloaded: 1538 times

Followed by: 1 user

License: MIT license  

An timer application with four independent programmable outputs each one with eight ON/OFF programs on daily basis (0-24h). Fully supported via an character LCD interface gives a comfort of setting the desired program. Additional usefull settings implemented also.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Programmable Timer" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Programmable Timer" changes.

Do you want to report abuse regarding "Programmable Timer".

  • Information
  • Comments (2)
DOWNLOAD LINK RELATED COMPILER CONTAINS
Other PIC Compilers
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

Project Blog

For the first time RTC chip initialization -> while the system is powered off, keep pressed down RA4 button then switch on the power, wait the time to appear on the screen and finally release RA4 button.

NEW:

A Project file with LCD module placed in its slot on the development board added: code ADAPTED to work on this configuration -> there are some timing incompatibilities in this mode, in other words it is manifested on the LCD interface which is not all the way "fluent" as well as in the demonstration example already posted before (the configuration bellow). This probably may be solved later but it does not affect the timer functionallity. It can be easy checked now.

Test: EasyPIC7, MCU PIC18F4620 or PIC18F45K22, LCD WH1602B, appropriate RTC module with DS1307 chip connected on the development board PORTC pinout (SQW/OUT on RC2)

Timer outputs on PORTD:

OUTPUT A: RD0

OUTPUT B: RD1

OUTPUTC: RD2

OUTPUTD: RD3


       

 

Functional device components:

Core: PIC18F4620 on 8Mhz & RTC module (DS1307)

Input terminal
    Six push buttons on PORTA (pull down mode)
    - Navigation keypad:
      UP                                     button: RA0
      DOWN                              button: RA1    
    Processing keypad
    - ENTER/SET/CONFIRM     button: RA2
    - BACK/CANCEL                  button: RA3
    - BACK to main screen      button: RA5
    Additional keypad:
    - OPTIONS                          button: RA4 

         
Output terminal: 16x2 character LCD with data bus on PORTD (8-bit mode) and control bus on PORTC 

Timer outputs on PORTB:
    OUTPUT A: RB2
    OUTPUT B: RB3
    OUTPUT C: RB4
    OUTPUT D: RB5                         


                                                               TIMER PROGRAMMABLE TABLE (empty) 


  OUTPUT A (8 channels):        OUTPUT (8 channels):        OUTPUT (8 channels):         OUTPUT (8 channels): 


  A1  -- : -- : --  START             B1  -- : -- : --  START             C1  -- : -- : --  START              D1  -- : -- : --  START                -- : -- : --   STOP                    -- : -- : --  STOP                     -- : -- : --  STOP                      -- : -- : --  STOP  

  A2  -- : -- : --  START             B2  -- : -- : --  START             C2  -- : -- : --  START              D2  -- : -- : --  START                -- : -- : --   STOP                    -- : -- : --  STOP                     -- : -- : --  STOP                      -- : -- : --  STOP 

  A3  -- : -- : --  START             B3  -- : -- : --  START             C3  -- : -- : --  START              D3  -- : -- : --  START                -- : -- : --   STOP                    -- : -- : --  STOP                     -- : -- : --  STOP                      -- : -- : --  STOP 

  A4  -- : -- : --  START             B4  -- : -- : --  START             C4  -- : -- : --  START              D4  -- : -- : --  START                -- : -- : --   STOP                    -- : -- : --  STOP                     -- : -- : --  STOP                      -- : -- : --  STOP 

  A5  -- : -- : --  START             B5  -- : -- : --  START             C5  -- : -- : --  START              D5  -- : -- : --  START                -- : -- : --   STOP                    -- : -- : --  STOP                     -- : -- : --  STOP                      -- : -- : --  STOP 

  A6  -- : -- : --  START             B6  -- : -- : --  START             C6  -- : -- : --  START              D6  -- : -- : --  START                -- : -- : --   STOP                    -- : -- : --  STOP                     -- : -- : --  STOP                      -- : -- : --  STOP 

  A7  -- : -- : --  START             B7  -- : -- : --  START             C7  -- : -- : --  START              D7  -- : -- : --  START                -- : -- : --   STOP                    -- : -- : --  STOP                     -- : -- : --  STOP                      -- : -- : --  STOP 

  A8  -- : -- : --  START             B8  -- : -- : --  START             C8  -- : -- : --  START              D8  -- : -- : --  START                -- : -- : --   STOP                    -- : -- : --  STOP                     -- : -- : --  STOP                      -- : -- : --  STOP 


 

NOTE: Just after the MCU (PIC18F4620 in this example) is first time programmed the user should take the action of clearing the timer programmable memory space in order to get the above table empty (formated) before processes other actions: SETTINGS\CLEAR ALL\CONFIRM->YES 
      (this routine is regularly used any time when want to get the timer programmable space empty)

There are three DELETE options: 
1) delete the whole memory (all four timer clear) as already said 
2)delete the program (all eight channels) of each output (A,B,C,D) independently
3)delete per channel (one from the group of eight ON/OFF programs) -> press OPTIONS button   than confirm DELETE by pressing the CONFIRM button; all these actions perform while the current channel (ON/OFF program) is on the screen 

NOTE: It is on user to respect a logic rule when set the desired program from the fact that two or more channels within the appropriate output should not be programmed to be overlapped among each other

      like in this example: 
-------------------------------------------------------
     NOT CORRECT:         CORRECT:
-------------------------------------------------------
    A1 12:30:00 ON         A1 12:30:00 ON
          16:00:00 OFF             18:00:00 OFF 

    A2 14:00:00 ON
          18:00:00 OFF    
-------------------------------------------------------

      or similar example:
--------------------------------------------------------
        NOT correct:            CORRECT:
--------------------------------------------------------
    A1 12:30:00 ON         A1 12:30:00 ON
          16:00:00 OFF              18:00:00 OFF 

    A2 16:00:00 ON
          18:00:00 OFF
------------------------------------------------------------------

There is no rule which from the eight channels would be programmed first or left unprogrammed etc. from the programming or the time point of view, but good practice may be to start from the channel one 

as in example:   

    A2 12:30:00 ON                 A1 12:30:00 ON
          16:00:00 OFF                     16:00:00 OFF 

    A4 20:15:00 ON                A2 16:20:05 ON
          20:15:45 OFF                    17:21:42 OFF

    A7 16:20:05 ON                A3 20:15:00 ON           
          17:21:42 OFF                     20:15:45 OFF


A1,A3,A4,A5,A6,A8 empty          A4...A8 empty

The Left side of the example is allowed but obviously it is not clearly logical as the program on the right. Only if, from any reasons one or more up-to-that-moment-programmed channels should be disabled (deleted) and new channels involved with ON/OFF values which do not drop into the current programmed time scope, the case from the left above can occurr. Then it seems OK.  

In general every time moment from the range of 00:00:00 - 23:59:59 for either ON or OFF (START or STOP) point of time is allowed, there is just no sense to have the same ON/OFF moments (in general OFF has the priority). On this way an output (if programmed) at the limit case can be 23:59:59 ON and 1 sec OFF or vice versa (within the full range 0-24h). In any aspect is ON + OFF = 24h as the timer (A,B,C,D) output is in PROGRAM mode.     

The mode of all of the four outputs (ABCD) independently can be set in three different ways : PROGRAM, ON, OFF.
ON, OFF mode sets the output to be permanently ON or permanently OFF, regardless of that whether the timer is programmed or not. It can be usefull (OFF mode also) while programming the appropriate output (manuelly setting the desired program - a column from the table above) and then put it back to PROGRAM mode (the mode of real time function with the set program as a reference, what in fact is the main purpose of this application). 

This demonstration example is done and works on EasyPIC development system. The code is written in assembler.

Programmable timer

Program TIMER A, delete C1 channel. Timer outputs on MCU PORTB <RB5:RB2> A: RB2; B: RB1; C: RB3; D: RB4. Pin RBO is an input for square wave signal from RTC module with a frequency of 1Hz

Watch on YouTube

Programmable timer

Program TIMER C in short ON/OFF time intervals. Timer outputs on MCU PORTB <RB5:RB2> A: RB2; B: RB1; C: RB3; D: RB4. Pin RBO is an input for square wave signal from RTC module with a frequency of 1Hz.

Watch on YouTube

Programmable timer

Delete TIMER A,B program. Timer outputs on MCU PORTB <RB5:RB2> A: RB2; B: RB1; C: RB3; D: RB4. Pin RBO is an input for square wave signal from RTC module with a frequency of 1Hz

Watch on YouTube

ALSO FROM THIS AUTHOR

FTP Server

0

Demo - test; Simple embedded FTP server application in LAN environment based on PIC18F devices; Can be useful for special purposes. More on project blog page.

[Learn More]

Modbus RTU Master Implementation; GUI - demo

5

The project contains a simple graphical user interface software mainly used as a testing tool and integral part of the entire application which refers to the Modbus RTU application protocol implemented in master controllers based on MCUs. NEW: Modbus RTU Master function codes library, basic functions added

[Learn More]

Modbus RTU Implementation & Ladder Logic

5

This project contains some library code aimed to be used for developing slave PLC type controllers using microcontrollers for their hardware configurations

[Learn More]