News:

Let's find out together what makes a PIC Tick!

Main Menu

Create usage restrictions - demo limit

Started by Aries_Ryan, Jan 18, 2024, 02:59 PM

Previous topic - Next topic

Aries_Ryan

I tried to made a demo limit.
I tested on simulation it working, but tried it on real hardware wont work.
Please help and some suggestion.
Here are a code :
;-------------------------------------------------------------------------------
;**** Added by Fuse Configurator ****
; Use the Fuse Configurator plug-in to change these settings

Device = 16F877A
Xtal = 4
Declare Reminders Off
@ CONFIG_REQ = 0 ; Override Compiler's configuration settings
Asm-
__Config  0x3F7A ;FOSC_HS & WDTE_OFF & PWRTE_OFF & BOREN_ON & LVP_OFF & CPD_OFF & WRT_OFF & DEBUG_OFF & CP_OFF
Endasm-
;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------

'All_Digital =true

Declare LCD_Type 0               'text type
Declare LCD_DTPin PORTD.4        'assigns data lines
Declare LCD_ENPin PORTE.1        'enable pin
Declare LCD_RSPin PORTE.0        'RS line pin
Declare LCD_Interface 4          '4 or 8 line interface
Declare LCD_Lines 2              'lines in the display
Declare Float_Rounding = On
Declare Float_Display_Type = LARGE
Dim My_Counter_Limit_Is As Byte
 

 RunAfterMain:        'This make it main code it run then demo files
 

  My_Counter_Limit_Is = ERead 0
 If  My_Counter_Limit_Is < 4 Then      'This count number how many times

     My_Counter_Limit_Is = My_Counter_Limit_Is + 1
     EWrite 0, [My_Counter_Limit_Is]
       DelayMS 840
         
          Print At 1,1, Dec2 My_Counter_Limit_Is,"  Test Count"
     
      DelayMS 840
     GoTo Main
     
     EndIf
     
     GoTo ErrorSub
 
 Main:
   Print At 2,1, " Limit Times"
   DelayMS 640
   Print At 1,4, "Demo Counter  "
 
 End   
  ErrorSub:
    Print At 1,4, " Expired" 

Thanks.

trastikata

#1
You forgot to initialize the EEPROM, that's to say after programing the chip, the EEPROM at position 0 will read 0xFF thus immediately skipping the demo portion.

Edit:
Place an infinity loop after the  Error sub otherwise the program will print "Expired" multiple times.