Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 29, 2024, 05:55:33 05:55


Login with username, password and session length


Pages: 1 [2] 3  All
Print
Author Topic: MikroC for PIC using Proteus (zuisti's solutions)  (Read 84830 times)
0 Members and 1 Guest are viewing this topic.
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #25 on: September 16, 2017, 05:31:40 17:31 »

                    Compiler: mikroC Pro for PIC v6.01
         Proteus-only projects, using 2x16 LEDs and/or a 4x20 LCD
                        © Istvan K (zuisti), 2017

I made four projects that are in different folders:
  16F88_LED            18-pin PIC, 2x16 leds, exact timed multiplexing
  44K22_LED            40-pin PIC, non-multiplexed (direct) led control
  16F684_LCD          14-pin PIC, 4x20 LCD
  44K22_LCD-LED     LCD and LEDs, both at a time (see the video)

Common features:
- runtime switchable characteristic:
   lin:   6 to 100 %
   log: -36 to +12 dB, 3 dB/step
- a real wav audio file is used as an input (cannot be heard in Proteus)
- adjustable input LEVEL (sensitivity)
- 250 Hz refresh rate (4 ms)

LED bargraph:
- level-dependend LED colours (12 green, 3 yellow, 1 red; a total of 16 leds)

LCD:
- 16 chars wide bargraph using User Defined Chars (UDCs)
- always visible scale-line (part of all UDCs)
- displayed audio channel (R and L) and current unit (% or dB)
- displayed scale values (second line)
- level-dependend shapes (UDCs) to imitate the different led colours
- runtime switchable 3 different sets of shapes (UDCs): three diff. modes
- the first line shows the current characteristic (lin-log) and mode (0-1-2)

For more description see the included "README_FIRST.TXT" (and the source) files.
--------------

A video to show how to works the simulated LED and LCD VU meter
(the "44K22_LCD-LED" project was used, its circuit is attached as a GIF):
https://youtu.be/9ftmeEKwxGA
 
The included wav file greatly increases the size of the RAR (because it is not
really compressible). Therefore, I uploaded the complete RAR to the 4shared page:
https://www.4shared.com/rar/UHvcPpHKei/VUprojs_up.html
« Last Edit: November 04, 2017, 05:16:30 17:16 by zuisti » Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #26 on: October 06, 2017, 10:07:55 10:07 »

So far 17 downloads and no any feedback (and only 3 thankyou  Sad ), although I worked hard on it.
I would like to thank someone for a better (more effective) peak-hold algorithm than what I wrote and published.

Since then, I've made a 'one-line' stereo VU meter project, which only uses the bottom line of a 16x2 LCD.
The picture of the working simulation is attached, but I do not want to publish the entire project, sorry.

zuisti
« Last Edit: November 04, 2017, 05:19:12 17:19 by zuisti » Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #27 on: November 02, 2017, 10:08:53 22:08 »

16-stage stereo peak hold/decay VU meters, see my post #25 above.
  Attached the expanded and improved version 2.1.

What's new ..

Two new projects:

   the 'one-line' stereo VU meter, in the "ONELINE" folder (see my prev. post)

   on request a 2x10 LED version, in the "16F88_2x10led" folder. See this topic:
   http://www.sonsivri.to/forum/index.php?topic=64785.msg186112#msg186112


Fixes:

   The displaying of the text "lin/log" on the upper LCD line now changes already
   at runtime too (according the jumper).

   New, faster and smaller Lcd_Goto functions (see the "LCD_Lcd0.h").

   Separated "poscalc.h", so it is easier to create multiple instances with
   different names (and different, own static variables).


Each project was recompiled. Read more in the new, improved "README_FIRST.TXT".

Note:
To decrease the size of the uploaded RAR the "test.wav" file is missing in the "wav"
folder (as I wrote it is not really compressible). Please copy from the previous RAR.
Likewise, the video (the AVI file) is also missing as it has not changed.

Greeting,
zuisti
« Last Edit: November 04, 2017, 09:26:44 21:26 by zuisti » Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #28 on: November 04, 2017, 09:14:34 21:14 »

My forgotted promise (I apologize) but now I post the full version of the two MMD tasks.
Each "Proteus-only" project is completed with its C source file(s) and the DSN.
The projects were written in mikroC v6.01, using the "case sensitive" mode.

8pin_MMD   rs232 (and CTS) controlled, using a 'virtual' PIC16F683 (due of the COF).  
MMD_Ps2    PIC16F628A MMD circuit, controlled via real/emulated/simulated PS2 keyboard

Read more in my prev. posts (#8 to #11 in this topic).
-  for example see the pictures here:
http://www.sonsivri.to/forum/index.php?topic=52263.msg152862#msg152862

But - sorry - no any 'support', I do not have time. These are 'as-is' projects.

  A question:
- Would you be interest for the source of my PIC18_MMD project? This I've written a
long time ago (in 2012) yet in Proton BASIC. This link shows the features:
http://www.sonsivri.to/forum/index.php?topic=42842.0
If so, I will look in my archive ...

Edit: Found it, uploaded, here you go:
http://www.sonsivri.to/forum/index.php?topic=42842.msg186534#msg186534

Thanks
zuisti (Istvan K)

--------
pickit2: Please Keep this Topic Clean - make replies to posts here:
http://www.sonsivri.to/forum/index.php?topic=64785.0

« Last Edit: November 12, 2017, 09:01:55 09:01 by zuisti » Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #29 on: April 14, 2018, 10:55:41 22:55 »

I'm constantly working on my new mikroC libraries. As usual I'm using
family-dependent asm optimizations so the libraries remain closed as before.

Now my new Button library is presented, and attached a complete demo project
which detailly shows the usage. Here is the C source:
Code:
/* Button_demo.c (to show how to use my new Button library)

  © Istvan K (zuisti), Apr. 2018

Tried in Proteus using the "628_button_demo.DSN" (PIC16F628A)

  Do not select the standard Button library (name conflict !!), instead
  my new p*_Button.mcl (now p* = p16) is used locally (found in 'lib' folder).
  Simply add the library to the 'Binaries' node in the IDE's 'Project Manager'.

The library allows to use three functions (see also below, in the program):  */

extern char Button(char* port,         // port address (&PORTx)
                   char  pin,          // pin number (0..7)
                   char  DtimeMs,      // debounce time in ms (0-255)
                   char  wantedstate); // 0 or 1
/* exactly the same as the original function (see help) but
   it produces much less code and more useful return values:
if the pin was in the wanted state for the given period then (as the original)
it returns with a nonzero value (and Z_bit will be 0) but this (always nonzero)
value is the internally calculated pin-mask, which is more useful than the 255
(the demo program shows an example how to use this feature).
  Otherwise (ie if no match) it returns 0 and Z_bit will be 1 so this flag
can be tested instead of R0 (less code)  */

extern char WaitPress(char* port,
                      char  pin,
                      char  timelimit, // in 20 ms unit, longpress limit
                      char  pressedstate);
/* blocking function: wait for the keypress with debouncing, 'measures'
the lenght of the keystroke then waits for releasing also with debouncing.
 Returns 1 (and Z_bit = 1) if the lenght is less than the given 'timelimit'.
Otherwise, in case of a 'long' press, it returns 2 and Z_bit will be 0.  */

extern char isPressed(char* port,
                      char  pin,
                      char  timelimit, // timeout and longpress limit
                      char  pressedstate);
/* non-blocking function: wait for the keypress with timeout and debouncing.
The parameter 'timelimit' is used as timeout value also, and if it does not
detect a valid keypress in this time interval (time is off) then returns 0
and Z_bit will be 1. Otherwise, as the above, it 'measures' the lenght of the
keystroke then waits for releasing also with debouncing. In this case Z_bit
is zeroed and returns 1 if the lenght is less than the given 'timelimit', and
returns 2 in case of a 'long' press (lenght of the keypress >= timelimit)   */

// ------------

// a (not so useful :-) demo program to show the usage of the above functions:
void main(void) {

  NOT_RBPU_bit = 0; // portb pullups on (active 0 buttons)

  // WaitPress() is a blocking function so it is placed outside of the main loop
  R7 = WaitPress(&PORTB, 5, 25, 0); // on Rb5, 25*20=500 ms timelimit, 0 active
  // its return value (R7) is watched in Proteus (in the 'Watch' window)
  // ** depending on the specific value we can create more program branches here

  while (1) { // loop time is appr 0.5 sec due to the isPressed() timeout

   if (isPressed(&PORTB, 6, 25, 0)) { // on Rb6, 25*20=500 ms timelimit, 0 active
      R8 = R0; // watched too (1 or 2)
   }
   // next line shows the usage of the Z flag as return value (0: matched)
   else if (Button(&PORTB, 7, 20, 0), !Z_bit) { // Rb7, 20ms debouncing, 0 wanted
      R8 = 0;  // clear the last isPressed() result (apply a long press !!)
   }
   // continuous watching the four dipswitch states using only one variable (R9)
   R9 = 0;
   R9 |= Button(&PORTB, 0, 20, 1); // Rb0, 20ms, 1 wanted  *** and so on ***
   R9 |= Button(&PORTB, 1, 20, 1);
   R9 |= Button(&PORTB, 2, 20, 1);
   R9 |= Button(&PORTB, 3, 20, 1);
   // eg. this is what the new return value (pin-mask, instead of 255) allows.
  }
}
I hope it will be useful also for you, try it out.
zuisti
Here is the Proteus screenshot and the project ZIP


Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #30 on: April 28, 2018, 03:20:37 15:20 »


My new "LCD ready" Keypad libraries can be divided into two main categories:
- 4x4 keypad libraries
- 4x3 keypad libraries (having one free port-pin which can be used as LCD_EN)
Both have two versions:
- using column pulldown resistors
- using column pullup resistors (may be internal !)

Of course, all the libraries were made in 3 different versions according to the
3 different PIC families (p16, p16_Enh and p18).

The Keypad libraries are "LCD-ready", which means that the same port can be used
to control an alphanumeric LCD, using the standard mikroC library.

For detailed description look at the attached "8pinKeypad_lib_DOC.H" file.

Attached also a complete demo project to show how to use my new Keypad library.
"LCD, 4x3 (phone) keypad and two momentary buttons: all on one 8-bit port"
- switchable numeric/alpha (upper and lowercase) keypad characters,
- displays a '!' warning char while a button (key) pressed and does not released,
- Proteus simulation, using a standard 4x3 "phone" keypad device and a 16x2 LCD.
A screenshot is also attached.

I hope it will be useful also for you, try it out.
IstvanK
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #31 on: August 27, 2018, 12:27:55 00:27 »

On request I wrote (in 2015) a PIC program to decode and display the standard RC5 remote contoller's signal. As I do not have such controller, to try the program I made also an interactive (8-button) EasyHDL script generator in Proteus to emulate the remote contoller:
one-shot or repeating, idle: HI, true toggle-bit handling, also extended commands ...

For details see the C source file in the attached project.
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #32 on: September 04, 2018, 11:07:16 23:07 »

As on the old (non-smart) phones each keypad button allows us to choose more (here: six) variants.  For example:
-   to choose the 3rd variant (char): short keypress 3 times,
-   6th ie the last variant (often a digit): 1 long keystroke
The 6 variants per button allow you to use the full English ABC and all the punctuation marks.

By default, letters are uppercase (can be changed any time), the lowercase letters in the table (f,b,s,c,t) execute a command. See the picture below and the C source files.
I made a complete Proteus project (attached) to show how to use it. The project is full with sources, it uses only standard mikroC libraries.
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #33 on: September 09, 2018, 11:33:23 23:33 »

The program is waiting for a key to be pressed and then emits its code to the serial (TTL-level RS232) output. After releasing the key, it sends a zero character (in the Proteus an 'r' letter).

Selectable (by a jumper) 4x4 or 4x3 keypad output codes: see picture.

The switchable p12 keypad library (written by me, using a lot of assembly codes) is attached in binary ie MCL form. The operating program is written in mikroC, so it is easy to customize.

This small circuit can be built as a backpack for an existing 4x4 keypad.
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #34 on: November 06, 2018, 03:57:53 15:57 »


Full function alarm clock using a DS1307:

- (only) two-button treatment, 16x2 LCD with I2C 'backpack', blinking alarm LED
- adjustable RTC time-date, the (abbreviated) name of the day too
- settable alarm (status, hours and mins), stored also in RTC user ram
- restore alarm settings at next power-on (remember it if we have RTC battery)
- the alarm lasts for 1 min but can be switch off at the touch of a button
and so on, see the picture, the source files, and try the working simulation.

It's not a big deal to write a program with the above features if you have an MCU with many ROM and RAM, but this little PIC was a real challenge.

The PIC12F629 I'm using is really small, having only 1024 program words and 48 bytes RAM. The program (written in mikroC) occupies almost all the resources:
- Used ROM (program words): 1019 (100%), free: 5 (0%)
- Used RAM (bytes): 41 (85%)  Free: 7 (15%); according to the compiler's "log" file

To do this, I had to use own (very small but fast) Sw I2C and LCD functions, and the applied algorithms are also new (for example, there are no bcd-dec and dec-bcd conversions). True, in this digit-oriented algorithm, the programming of the limits (for ex. the month can only be 1-12) is a bit cumbersome and also the code space is too small so this is not complete but can be used (pay attention).

Even so, I used also some tricks with the FSR (named also as FSRPTR, which is an 1-byte C pointer in the non-enhanced p12/p16 world: less code !) and the INDF (treated as a char pointed by the FSR).

The program itself is very concise, not so easy to understand, although I tried to make many comments. Only for experienced PIC programmers, sorry.

The here applied Sw I2C and LCD functions I tried also in the real world (in another program), they worked well.

----------
However, since I find so that here is no real interest in my simple PIC projects, now I uploaded only the Proteus simulation and the HEX file (compiled especially to taking into account how works the simulated DS1307 device), and look forward to the comments from those who have tried it.

I would be delighted if someone would write a better clock program for this little PIC, but I would also like to welcome any suggestions. Thanks in advance ..

Istvan K (alias zuisti)
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #35 on: December 11, 2018, 11:19:47 11:19 »

  In my previous post I uploaded the working Proteus simulation of my first solution (with PIC12F629), hoping to get some feedback. Well, so far 27 downloads (with 6 thankyou's, thanks :-), but no any response, comment nor advice. That is why I do not upload the entire project, it makes no sense.

  In the meantime, I've been upgrading (finishing?) the Clock project, that I want now to show. As the supplements were not fit in the small PIC, I used the larger PIC12F683, having 2k code memory. Perhaps this may be more interesting, but at least try it out:

Alarm Clock with auto day-of-week calculation:

- the program works as well with the DS1307, DS3231(M) or DS3232 chips (using same HEX)
       to show this, I made a switchable Proteus simulation also (do not switch RTC while runs)

- auto day-of-week calculation and display (also while day, month or year is modified)

- the alarm settings are saved (and restored at next power-on)

- different buttons to increase/decrease the selected value, using its specific limits:
     sec, min: 0 to 59
     hour: 0 to 23 (24 hours mode)
     day: 1 to 31 (or 28 or 29 or 30, depends on the month and year, calculated)
     month: 1 to 12
     year: 1 to 99 (2001 to 2099), leap-year handling

- auto back repair (an interesting problem I faced to, hope it's solved):

 Not as often, but modify of the month can be resulted also an invalid day-value. An example: if the date is 31-12-18 and we modify the month to 11 (November is a 30-day month), then the resulting date (31-11-18) would be invalid. In such cases the program will step back to the day's adjusting (to signalize the repair) and automatically corrects the day's value (in our example the invalid 31 will be 30), so the final date (30-11-18) also will be valid.
This is my solution, the "back repair". Try it out.

I'm really looking forward to your valued comments and advices.
Regards,
Istvan K (alias zuisti)
PS:
I apologize for the bad English.

« Last Edit: December 29, 2018, 09:10:30 21:10 by zuisti » Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #36 on: February 20, 2019, 12:47:36 00:47 »

The newest update of my RTC project is the "Multi-Alarm Clock", that I want now to show.
Here are the new features (but also look at my previous posts) :

- three independent daily alarms (a-b-c), choosable displaying
- alternating date and temperature display (can be off)
- button sounds (acoustic feedback, can be off)
- the settings are valid until power-off but can be stored
- forced cold start (without battery detach):

    set the C alarm to 00:00, it is working fine until
    power-off, but the next power-up produces a cold start.
    Alarms A or B work well at 00:00 also, so use them if
    you really want to wake up daily at midnight :-)

It works well with Ds1307 and also the Ds3231M (see photos), using the same HEX.
This HEX is also used by the included Proteus simulation, which shows the treatment
in detail (see GIF images). This way you can test the Clock without building it, so
I'm looking forward your valued comments and advices.

---------

The circuit was built on a breadboard, using cheap chinese modules I bought on Aliexpress:

16x2 I2C LCD module (using a PCF8574 I2C 8-bit port-expander backpack)
Its I2C address is 0x4E (in 7-bit form: 0x27), fixed: A0..A2 tied to VCC

RTC modules, using a 3.6v LIR2032 accu (just one RTC module is used at a time :-)
- "ZS-042" RTC module (mine is Ds3231M, unfortunately)
- Tiny RTC I2C module (Ds1307)

An experience with the Tiny RTC module:
 Due to the 3.6v accumulator, the "original" Ds1307 module uses a high-impedance
voltage divider, that makes it susceptible to interferences and can cause startup
problems. A small filter capacitor (47-100nF) on the BAT terminal solves this problem.
 Or - modify the module (in a way that can be found on the net) to be use a 3v CR2032 coin cell.
But .. due to my weak vision (I'm 75) I didn't do this.

Note:
The Ds3231M is less accurate, but has an advantage also: it updates the temperature
registers every 10 seconds while the Ds3231SN only every 64 seconds.

Regards,
zuisti
PS: Sorry for the bad quality photos ..
Logged
papy_bidouille
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 128
-Receive: 22


« Reply #37 on: February 21, 2019, 04:49:41 16:49 »

hello zuisti
would there still be some room to put an alarm on the temperature .temperature at 1 or 2 degree C ° "frost free" even this one is fixed at the compilation
cordially
« Last Edit: February 21, 2019, 04:57:08 16:57 by papy_bidouille » Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #38 on: February 21, 2019, 07:48:04 19:48 »

.. would there still be some room to put an alarm on the temperature .temperature at 1 or 2 degree C ° "frost free" ...

  An interesting idea. Using this small processor this is not feasible as it is already almost full, but it is possible when we use a larger processor eg the 12F1840. I do not promise anything, but if I have time and energy, I will try.

 Otherwise, what do you think? Don't need the three timed alarms, but warns if the temperature measured by the DS3231's built-in sensor falls below the editable set value?
And what about hysteresis?
And can the temperature alarm be turned off?
  and so on ...

Note: you know, there are many much simpler solutions to this task on the net.
zuisti
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #39 on: March 17, 2019, 10:18:01 22:18 »


This is a small but useful extension for the 3-alarm clock (see my post #35 and #36).
The circuit (and its handling) remained unchanged, only the name (and operation) of the 3 alarms were modified as follows:

- W alarm (on Working days only, Monday through Friday)
- R alarm (on Rest days, Saturdays and Sundays only)
- A alarm (simple daily Alert, same as the alarm C in post #36 above)

  The pre-set (but adjustable) alarm times (at start all three are off):
w 07:00 (hour:minute, lowercase 'w' = disabled)
r  07:30
a 08:00 (usually this is not used ie remains off)

  Of course, the distinction between work days and rest days only works properly if the RTC time and date is set correctly on the first power-up.

  To try it, simply use the supplied new HEX, either in the Proteus simulation (using the DSN attached to my post #36), or in the real circuit, after re-burn the PIC.

Best regards,
zuisti
Logged
towlerg
Senior Member
****
Offline Offline

Posts: 263

Thank You
-Given: 474
-Receive: 104

What is this for?


« Reply #40 on: March 18, 2019, 12:31:09 12:31 »

Just object, no source? is this code proprietory?
Logged

Win 7 Ult x64 SP1 on HP2570p
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #41 on: March 18, 2019, 05:43:17 17:43 »


Just object, no source? is this code proprietory?
No, of course the entire code is mine and it is not patented (though not a bad idea :-)

I apologize, but - as I wrote also in my post #34 above - I'm unsatisfied that so many people download my projects, but I don't get any feedback. In future I don't want everyone (even a whole new member) be able to download the entire project.

Those who are really interested in the projects will find a way to get in touch with me, and so I always know who got the whole project (strictly for their own use).

I have to say that these RTC clock programs are not very simple and transparent, because I wrote them primarily to myself (using mikroC v6.01). But ... they work well also in reality.

One more note: my programs use a lot of assembly instructions (due to higher speed and less code). Even so, for example the last project (the weekly alarm clock) code leaves a total of 1 (one !) free program word out of 2K.

In short, I suggest these programs only for experienced PIC users.

Regards:
zuisti
Logged
towlerg
Senior Member
****
Offline Offline

Posts: 263

Thank You
-Given: 474
-Receive: 104

What is this for?


« Reply #42 on: March 19, 2019, 01:43:24 13:43 »

Zuisti, of course you are entitled to protect your work. I have no interest in the project per say but it's useful to see how different people deal with the interface to the various components used in your project.

I hope you don't think this is patronising, but very nice work.
Logged

Win 7 Ult x64 SP1 on HP2570p
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #43 on: April 08, 2019, 12:44:46 00:44 »

  My last project (the Weekly Alarm Clock, see above, the post #39) has been built by several of my friends and is still being used with satisfaction.
  Now I present my latest job, which is also useful in practice, I think so.
That is a 8-output Weekly Switch Clock (like the previous ones, this is also a HEX project that can be built, but it can be tested also in the attached Proteus simulation).

Short description:

The system can handle a total of 52 independent scheduled events (operations).
Each event has a unique name (A..Z, a..z) and has 4 editable attributes:
- action type; the given output bit(s) will be:
    '+' (HI) 
    '-' (LO) 
    't' (toggled) 
    '.' --------- the event is disabled
- the output bit to be modified (0..7, 8: all)
- the executing time: hours (in 24 hrs form) and minutes
- the day(s) when the event is executed:
    'Su' or 'Mo' or ... 'Sa' (only on the specific day of the week)
    'wD' (on working days only, Monday through Friday)
    'rD' (on rest days, Saturdays and Sundays only)
    'eD' (every day)

  Initially all events are set to ".1 12:00 eD" (disabled !, outbit=1, hour=12, min=0, every day), but all changes will be saved (in a compressed form) when we exit from the event editor. I use the I2C EEprom on the RTC module to store the 52 events, but they are copied to the PIC RAM too, for quick time-comparing.

  The attached HEX is assuming the Chinese DS3231 RTC module (named as ZS-042, see the post #36), the DS1307 Tiny RTC module I2C EEProm's address is different (0xA0, instead of 0xAE). This also can be used, and the DS3232 too (without EEprom as it has enough free RAM, but that is not a PDIP device). I have also created and tested these HEX files (one for the DS1307 Tiny module and the other for the standalone DS3232), on request I can send them.
  The 8-bit output is also a Chinese module: a PCF8574 I2C port expander with 3 address switches. If necessary, use a buffer IC too.
     
  The system stores all changes (including the settings and the status of the outputs) immediately, and after a power failure it restores everything: real warm restart.
  The last executed event is also stored (and displayed, in abbreviated form, eg C+3).
If it was a full 8-bit set/reset (using the buttons or initially) then "++8" or "--8" will be displayed as that is not a real timed event.
  Because of the finite (though very long) EEprom lifetime, the above immediate "backups" use the RTC RAM.

  In addition, the display shows the time and the day of the week, while the second line displays the status of the output bits.
  The full date and the measured temperature are displayed when we change the beep, ie turn on (or off), but only for cca 2.5 seconds (I think this is more than enough).

Look at the picture of the simulation for details.

Build it!
zuisti
Logged
FranzW
Active Member
***
Offline Offline

Posts: 182

Thank You
-Given: 589
-Receive: 81



« Reply #44 on: October 13, 2019, 09:23:55 21:23 »

Upon request, I created an improved variant (add to my BarGraph library DEMO programs):

-  SW filtering:   four measurings/channel then average value will be calculated but only
   when it detects a difference compared to the previous (stored) average value, else the
   fast scanning (appr 9 ms / 8 channels) will be continued.
    - an improved 50 Hz noise suppression also can be used (with appropriate delays)

-  on the fly switchable high-res (pixel) bargraphs, now with rounded voltages
   and channel-number displaying (not the best but the space is limited)
 

   As before:

no floating arithmetics (fast)

-  small code (my all-in-one BarGraph function is only 213 bytes long on a P16)

-  full scale = Vref (VCC, now 4.9 V), with SW correction: see the docs.

-  resolution = 0.001 V (but 0.01 V with bargraph, after rounding)

-  accuracy   = +-0.1% (max 5 mV), plus the PIC's own ADC error, of course :-)
 

The entire mikroC project is attached, with the C source (detailed comments) and the DSN file. In Proteus (I tested only here !) it uses the COF compiler output so a source-level step-by-step debugging is also possible.

The pictures show the simulated circuit and the bargraph displaying (same input voltages).

zuisti

Hello zuisti,
Thanks for your post. The three files seem to be corrupted. Would you  please upload them again?
Best regards,
FranzW
Logged
sphinx
Hero Member
*****
Offline Offline

Posts: 915

Thank You
-Given: 606
-Receive: 265



« Reply #45 on: October 13, 2019, 10:26:37 22:26 »

here you go
Logged

laws of physics are not laws at all, just assumptions and formulas that work as long as we don't figure something new that wrecks the calculations. the infinite onion try to peel that one
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #46 on: October 13, 2019, 11:53:06 23:53 »

Hello zuisti,
... The three files seem to be corrupted. Would you  please upload them again?
@FranzW: the corrupted file is uploaded (attached) again.
But note: this is a very old solution written by me :-)
Hi there,
zuisti
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #47 on: May 19, 2020, 10:36:04 10:36 »

This project is an improvement of my LCD clock programs (see the posts #35 and #36 above, in this thread). It uses the same hardware, complete with a PNP transistor that allows the LED and BUZZER to be controlled independently (see the schematic).
 
Large-digit hour-min display using user-defined chars. These chars also use the lowest,ie the 8th pixel-line (see photo), which Proteus cannot display due to an error of the LCD model. For this reason, the simulation runs with a modified HEX file in which the UDCs are using only 7 pixel-lines. Because of this, the large digits are not as 'beautiful' but recognizable also in Proteus.

The system can be customized at runtime (almost everything is adjustable).
New  settings are saved, using the RAM of the RTC and (for the corrs) the PIC's EEPROM.

At startup, all settings are displayed for one sec (or while INC is  hold down).
This also can be turned off (using DEC):
Code:
     S/s: suppress zero '10hours' on/off
     | T/t: alternating Temperature-Date displaying on/off
     | | B/b: button sounds (acoustic feedback) on/off
     | | | A/a: alarm beeps (ringing) on/off
     | | | | F/f: star/T flashing on/off
     | | | | | U/D: snooze/timer count up/down
     | | | | | |    (elapsed /remaining time display)
     | | | | | |
Set: s t B A f D    >>  default (initial) settings
Corrs: 05 01 -14    >>  defaults, the -1.4 ppm is an empirical value
       |  |   |
       |  |   .1ppm (RTC align: aging reg's value, -99 to +99 * 0.1 ppm)
       |  len_A (alarm ringing time, 0 to 99 minutes)
       snooze duration, 1 to 99 minutes; the timer also uses this value

There are three different alarms:
   A0 (w): on every workday (Monday to Friday)
   A1 (r): on every rest day (Saturday or Sunday)
   A2 (e): on every day of the week, or only once ('s'ingle), changeable
Their actual type (state) appears also on the normal display (eg WRe: A0 and A1 are active but A2 is not)

The DSN captions show the treatment in detail, except for the following:
    Changing the type of A2 is a bit tricky:
  In the alarm editor choose A2 and then press INC:
  now only the type changes ('e'very <> 's'ingle) as there is no A3 :-)

- Visual feedback of any button press or while alarm (LED flashing).
- Acoustic signals (beeps), can be turned off

- Classic snooze, can be started only while alarm; restartable and deletable.
- General up/down timer, can be started at any time except while alarming.
- The snooze/timer is interrupted by an (other) alarm scheduled for its duration.
- Priority order: A0(A1) - A2 - snooze/timer expiring

- Forced cold start (see post #36) is moved to A1 (set 'r' alarm to 00:00)

-------
Attachments:
- a photo of the clock constructed (see the large digits)
- the complete, well working Proteus simulation (try it).
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #48 on: November 20, 2021, 10:21:05 10:21 »

Further development of my last project (see above, the post #47):

        HW changes:
- 4x20 LCD (instead of the 2x16): larger display, more info.
- rearranged port bits (to use HW I2C routines instead of the old SW I2C).

        Missing (omitted) features, compared to the previous one:
- snooze/timer elapsed time displaying (count up),
    now always the remaining time is displayed (countdown).
- forced cold start.

        New functions:
- 16-sec timeout in each editor, can be off.
- clock's ticking (short LED or buzz signal, once per sec), can be off.
- changeable fonts for the large clock digits (thin:0 - bold:1 - huge:2);
    As long as you hold down the DEC key, each short press of SET selects
    and displays the name and nr of the next font (cyclic: 0-1-2-0-1 ...).
    Release the DEC button to display the clock in the last selected font.

The assembled circuit (on a breadboard, see photo) is working properly.

Note: The very short (10 msec) tick signals work perfectly in the reality
    (both for LED and Buzz), but this short LED signal is not visible in
    Proteus while the Buzz signal works well. Maybe a Proteus setting ??
Edited: the issue is solved, look at this new topic:
http://www.sonsivri.to/forum/index.php?topic=69802.msg202463#msg202463
In that topic I answer questions about how simulation works.  

        About the source:
I wrote it for myself (using mikroC v6.01, without the compiler's closed libraries),
and I'm constantly working on optimizing. The included code is the (well-functioning)
last version that is still relatively easy to read (and understand).
  Subsequent optimizations make it increasingly difficult for other people to
understand the code. But, with these I have achieved significant RAM and FLASH
savings (important for in the future planned improvements).

The code itself is quite large and complicated (many unusual asm tricks).
Since I wrote it to myself, there are relatively few comments (sorry).
Therefore, I only recommend it to really experienced PIC programmers.

This is an "as-is" software (no any support), sorry but I do not have time.

** To get all source files first read the "src_readme.txt" file in the attached RAR.

Regards:
zuisti
« Last Edit: February 14, 2022, 01:19:05 01:19 by zuisti » Logged
sphinx
Hero Member
*****
Offline Offline

Posts: 915

Thank You
-Given: 606
-Receive: 265



« Reply #49 on: April 07, 2022, 04:34:14 16:34 »


https://www.sonsivri.to/forum/index.php?topic=52263.msg159103#msg159103

https://www.sonsivri.to/forum/index.php?topic=52263.msg159103#msg159103

i know these files are sort of old in these posts but ask if it possible to repost the file if possible
thnx in advance
Logged

laws of physics are not laws at all, just assumptions and formulas that work as long as we don't figure something new that wrecks the calculations. the infinite onion try to peel that one
Pages: 1 [2] 3  All
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC