Old classic If-Then...


Results 1 to 17 of 17

Threaded View

  1. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi Ioannis

    I do not Understand you ...

    Code:
    'Essai 16F84 Random
    
    DEFINE LCD_EBIT 1                          ' Other LCD pins are same as Manual - Holy Manual - my sweet Manual ...
    
    '   DEFINE LCD_DREG PORTB               ' I/O port where LCD is connected
    '   DEFINE LCD_DBIT 0
    '   DEFINE LCD_RSREG PORTB
    '   DEFINE LCD_RSBIT 4                  ' Register select pin
    '   DEFINE LCD_EREG PORTB
    '   DEFINE LCD_EBIT 5                   ' Enable pin
    '   DEFINE LCD_BITS 4                   ' 4-bit data bus
    '   DEFINE LCD_LINES 2                  ' LCD has 2 character lines
     
       DEFINE OSC 4
       
    @	__config _XT_OSC & _WDT_ON & _CP_OFF
    
    '*****************************************************************************
    'Variables
    
    Level 	   		var Word
    High_Level 		var Word
    
    Onboard_an2		var Word
    PressLimit 		var Word
    
    Auto1			var Bit
    Thermikol 		var Bit
    Thermistor1		var Bit
    Pump			var Bit
    
    LevelOk			var Bit
    PressOk			var Bit
    
    module_rel_out	var Portb.7
    
    '*****************************************************************************
    'Constantes
    
    '*****************************************************************************
    'Preset
    
    CLEAR
    
    PORTA = 0
    PORTB = 0
    
    TRISA = 0
    TRISB = 0
    
    High_Level 	= 40000
    Level		= 0
    Thermikol   = 1
    Thermistor1	= 1
    Onboard_an2 = 500
    PressLimit 	= 35000
    
    Auto1		= 1
    Pump		= 0
    
    
    
    PAUSE 500
    
    LCDOUT $FE,1
    
    RANDOM Level
    RANDOM Onboard_An2
    
    Loop:
    
    RANDOM Level
    RANDOM Onboard_An2
    
    IF (level <= high_Level) THEN
     	PORTB.5 = 1
    ELSE
      	PORTB.5 = 0
    ENDIF
    
    IF ( onboard_an2 <= PressLimit ) THEN
     	PORTB.6 = 1
    ELSE
      	PORTB.6 = 0
    ENDIF
    
    Module_rel_out =  (level <= high_Level) && Thermikol && Thermistor1 && Auto1 && ( onboard_an2 <= PressLimit ) && !Pump  
    
    LCDOUT $FE,2,# Module_Rel_Out ,"   ",DEC5 Level ," ",DEC5 Onboard_an2 ,"  "
    LCDOUT $FE,$C0,"out", DEC5 High_Level, " ", DEC5 Presslimit 
    
    PAUSE 300
    
    IF Module_rel_out THEN PAUSE 500
    
    GOTO Loop
    
    END
    As you see ... I played somewhat with my Personnal Testboard to verify everything was running fine ...

    And it runs fine !!!

    "your" line is here :

    Code:
    Module_rel_out =  (level <= high_Level) && Thermikol && Thermistor1 && Auto1 && ( onboard_an2 <= PressLimit ) && !Pump
    ...

    Value Comparisons or logic levels have equal behaviour here ...

    Cheers ...

    Alain
    Last edited by Acetronics2; - 1st November 2008 at 15:33.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Classic
    By Haggar in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th April 2005, 10:57

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts