Device = 16F1939 Declare Reminders Off @ CONFIG_REQ = 0 ; Override Compiler's configuration settings Asm- __Config _Config1, 0x098C ;FOSC_INTOSC & WDTE_SWDTEN & PWRTE_ON & MCLRE_OFF & CP_OFF & CPD_OFF & BOREN_OFF & CLKOUTEN_OFF & IESO_OFF & FCMEN_OFF __Config _Config2, 0x1EFF ;WRT_OFF & VCAPEN_OFF & PLLEN_OFF & STVREN_ON & BORV_LO & LVP_OFF Endasm- Declare Reminders On ;**** End of Fuse Configurator Settings **** ;------------------------------------------------------------------------------- Declare Xtal = 8 OSCCON = %01110010 'FREQUENCY SET AT 8 MHz 'Xtal = 4 'OSCCON = %01101010 'FREQUENCY SET AT 8 MHz OSCTUNE = 0 'CENTER FREQUENCY Declare Float_Rounding = On Declare Float_Display_Type = Fast Declare Watchdog = On 'Declare Optimiser_Level = 1 Declare Dead_Code_Remove On ;Calculated Baudrate = 9615 @ Xtal 8MHz, sERROR = 0,16% Declare Hserial_RCSTA = 144 ; Enable continuous receive Declare Hserial_TXSTA = 32 ; Enable transmit, BRGH = 0 Declare Hserial_SPBRG = 12 ; Baud Rate Generator Value Declare Hserial_Clear = On ; Clear overflow automatically 'Declare Hserial_TXSTA 36 'high speed 'Declare Hserial_Clear yes Declare Adin_Res 10 ' Set the resolution to 10 Declare Adin_Tad 16_FOSC ' Choose the RC osc for ADC samples 'Adin_Tad 8_FOSC ' Choose the RC osc for ADC samples 'Adin_Tad FRC ' Choose the RC osc for ADC samples Declare Adin_Stime 100 ' Allow 100us for charge time Dim swTEMP0 As SWord Symbol HUNDRED = 100 ' value for calc 'Pre Load Port Pins PORTA = %00000000 ' Preset all ports values ! (MUST be specified) - TO DO !!! PORTB = %00000000 PORTC = %00000000 PORTD = %00000000 PORTE = %00000000 DelayMS 1000 Clear swTEMP0 = 10 Repeat If swTEMP0 > HUNDRED Then HRSOut SDec swTEMP0," > ",Dec HUNDRED," -> TRUE",13,10 Else HRSOut SDec swTEMP0," > ",Dec HUNDRED," -> FALSE",13,10 EndIf If HUNDRED < swTEMP0 Then HRSOut Dec HUNDRED," < ",SDec swTEMP0," -> TRUE",13,10 Else HRSOut Dec HUNDRED," < ",SDec swTEMP0," -> FALSE",13,10 EndIf HRSOut "-----",13,10 Dec swTEMP0 Until swTEMP0 = -10 '------------------------------------------------------------------------------------------------- '############################################################################## End