'*****************************************************************
'*  Name    : Muntenteller.BAS                                   *
'*  Author  : Stynus                                             *
'*  Notice  : Copyright (c) 2007 [ElektronicaStynus.be]          *
'*          : All Rights Reserved                                *
'*  Date    : 25/02/2007                                         *
'*  Version : 1.0                                                *
'*  Notes   :                                                    *
'*http://www.elektronicaforum.nl/kan-iemand-mij-helpen-t4033.html*
'*****************************************************************
Device = 16F628
Config INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, MCLRE_ON
ALL_DIGITAL     TRUE 
Symbol eenCent      = PORTA.0
Symbol tweeCent     = PORTA.1
Symbol vijfCent     = PORTA.2
Symbol tienCent     = PORTA.3
Symbol twintigCent  = PORTA.4
Symbol vijftigCent  = PORTA.6
Symbol eenEuro      = PORTA.7
Symbol tweeEuro     = PORTB.1
Dim eenCnt          As Float
Dim tweeCnt         As Float
Dim vijfCnt         As Float
Dim tienCnt         As Float
Dim twintigCnt      As Float
Dim vijftigCnt      As Float
Dim eenEur          As Float
Dim tweeEur         As Float
Dim bedrag          As Float
Declare             LCD_INTERFACE 4
Declare             LCD_LINES 4
Cls
Clear
'LCD layout
'123456789abcdefghijk
'Bedrag: 1234.10
'2 ;1 ;0,5;0,2;0,1
'xx;xx; xx; xx; xx
'5c=xx;2c=xx;1c=xx
Print At 1,1, "bedrag"
Print At 2,1, "2= 0 1= 0 0,50= 0"
Print At 3,1, "0,2= 0;0,1= 0 "
Print At 4,1, "0,05= 0:0,02= 0 "
loop:
bedrag = ( eenCnt * 0.01 ) 
bedrag = bedrag + ( tweeCnt * 0.02 )
bedrag = bedrag + ( vijfCnt * 0.05 )
bedrag = bedrag + ( tienCnt * 0.1 )
bedrag = bedrag + ( twintigCnt * 0.2 )
bedrag = bedrag + ( vijftigCnt * 0.5 )
bedrag = bedrag + eenEur 
bedrag = bedrag + ( tweeEur * 2 )
Print At 1,9,       Dec bedrag
Print At 3,1,       Dec tweeEur
Print At 3,4,       Dec eenEur
Print At 3,8,       Dec vijftigCnt
Print At 3,12,      Dec twintigCnt
Print At 3,16,      Dec tienCnt
Print At 4,4,       Dec vijfCnt
Print At 4,10,      Dec tweeCnt
Print At 4,16,      Dec eenCnt
'Sensoren inlezen
'2
If eenEuro      = 1 Then
    Inc eenEur
    DelayMS 10
EndIf
'1
If tweeEuro     = 1 Then
    Inc tweeEur
    DelayMS 10
EndIf
'0,50
If vijftigCent  = 1 Then
    Inc vijftigCnt
    DelayMS 10
EndIf
'0,20 
If twintigCent  = 1 Then
    Inc twintigCnt
    DelayMS 10
EndIf
'0,10
If tienCent     = 1 Then
    Inc tienCnt
    DelayMS 10
EndIf
'0,05
If vijfCent     = 1 Then
    Inc vijfCnt
    DelayMS 10
EndIf
'0,02
If tweeCent     = 1 Then
    Inc tweeCnt
    DelayMS 10
EndIf
'0,01
If eenCent      = 1 Then
    Inc eenCnt
    DelayMS 10
EndIf

GoTo loop
End