Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Can someone check my code Please? PicBasicpro

Status
Not open for further replies.

karenhornby

New Member
Can someone please have a read through this and tell me if I've made any mistakes as I dont have a method for testing yet.
Hopefully I've written it in Picbasic Pro ( I hope)
What its supposed to do is compare inputs B1 and B4 and IF they are BOTH high then make outputs B2 and B5 high and at the same time get the LCD on line 1 to display the word VEG-OIL

IF a pushbutton switch (on Input B6) is pressed then outputs B2 goes LOW and B5 stays HIGH and the LCD displays the word FLUSHING for a period of 10 seconds then both outputs B2 AND B5 go LOW and at the same time the LCD displays the word DIESEL


When the program starts the LCD display clears the screen, waits a period of 1 second then Line 1 displays the above, while LINE 2 displays the temperature as measured by the 3rd DS1620 continually while the PIC is powered up.


I wont claim to have written this code, most of it is borrowed from other examples online from various places ,all I did was modify the bits I wanted and HOPE it works!

Can anyone tell me the easiest PIC for this to work in, or if any code or pins need changing to work with other pics?

I based it all on the 16F877 ( i think) and please bear with me, I've pnly started getting interesting in programming PIC's in the last week and uptill today knew nothing about programming.

By the way, IF this does actually appear to work could anyone compile it for me please?
 

Attachments

  • OIL CONTROLLER.TXT
    2.9 KB · Views: 169
Last edited:
You didn't include your code. May I suggest that you enclose it in
Code:
 tags. By typing [code] and [/co de] (without the space) before and after your code, it makes it a lot easier to read.

Mike.
Edit, I see you added it now so ignore the above.
 
Last edited:
Sorry I'm only starting to learn about programming and dont even have a programmer as yet!
HOPEFULLY this is what you mean...

Code:
  ' PicBasic Pro program to read DS1620 3-wire temperature sensor connected to PORTC.0
‘PORTC.1 and PORTC.2
'  and display temperature on 2nd line of LCD AND display fuel state on LCD line 1

‘inputs are PORTB1 (DS1620) PORTB4 (DS1620) and PORTB6 (pushbutton switch)
 ‘Outputs are PORTB1 (SOLENOID 1) PORTB5 (SOLENOID 2) and LCD Display 2 X 16 or 2 X 20 in 4 bit mod
‘IF PORTB.6 = 1 the switch is closed on pin RB6 (pushbutton pressed)
‘IF and ONLY IF BOTH DS1620’s connected to PORTB.1 AND PORTB.4 are HIGH then BOTH OUTPUTS on PORTB.2 and ‘PORTB.5 are set HIGH  driving (through a transistor switch) a relay on each OUTPUT port.
‘IF the switch is closed on PORTB.6 then OUTPUTS on PORTB.1  goes LOW and PORTB.5 goes HIGH AND the display ‘shows the word FLUSHING for a period of 10 seconds and then all outputs reset to a LOW state and LCD displays the ‘word DIESEL
‘”HOPEFULLY” and hopefully using a 16F877 PIC CHIP


' Define LCD pins
Define  LCD_DREG        PORTD
Define  LCD_DBIT        4
Define  LCD_RSREG       PORTE
Define  LCD_RSBIT       0
Define  LCD_EREG        PORTE
Define  LCD_EBIT        1

' Alias pins
RST     var     PORTC.0         ' Reset pin
DQ      var     PORTC.1         ' Data pin
CLK     var     PORTC.3         ' Clock pin

' Allocate variables
temp    var     word            ' Storage for temperature

        Low RST                 ' Reset the device

        ADCON1 = 7              ' Set PORTA and PORTE to digital

        Low PORTE.2             ' LCD R/W line low (W)
        Pause 100               ' Wait for LCD to start

        Lcdout $fe, 1, “DIESEL” $C0 "Temp in degrees C"      ' Display sign-on message

input PORTB.1
output PORTB.2
input PORTB.4
output PORTB.5

input PORTB.6
output PORTB.7
MAIN
    if PORTB.1=1 then
    if PORTB.4=1  then
    if PORTB.6=0 then SOLENOID
 Endif

    If PORTB.1=1 then
    If PORTB.4=1 then
    If PORTB.6=1 then PURGE
 Endif

' Temploop to read the temperature and display on LCD
Temploop:
        RST = 1                 ' Enable device
        Shiftout DQ, CLK, LSBFIRST, [$ee]       ' Start conversion
        RST = 0

        Pause 1000              ' Wait 1 second for conversion to complete

        RST = 1
        Shiftout DQ, CLK, LSBFIRST, [$aa]       ' Send read command
        Shiftin DQ, CLK, LSBPRE, [temp\9]       ' Read 9 bit temperature
        RST = 0

        ' Display the decimal temperature
        Lcdout $fe,$C0,  dec (temp >> 1), ".", dec (temp.0 * 5), " degrees C"
                Goto Temploop           ' Do it forever

‘PURGE flushes IP pump of oil and replaces it with diesel
Purge:
Output PORTB.2 1
Output PORTB.5 0 
Lcdout $fe “FLUSHING”
Pause 1000 ’10 second hold before solenoids are reset
Output PORTB.2 0
Output PORTB.5 0
Lcdout $fe “Diesel”

‘SOLENOID send outputs to solenoids and display fuel state on LCD
SOLENOID:
Output PORTB.2 1
Output PORTB,5 1
Lcdout $fe “VEG-OIL”
 
Last edited:
I've never used PicBasic and so I'm not sure of the syntax. I think what you want is something like,
Code:
Main:
    If (PORTB.1=1) and (PORTB.4=1) and (PORTB.6=0) then
        Lcdout $fe,1,"VEG-OIL"
        PORTB.2=1
        PORTB.6=1
    Endif
    If (PORTB.1=1) and (PORTB.4=1) and (PORTB.6=1) then
        Lcdout $fe,1,"FLUSHING"
        PORTB.2=1
        PORTB.5=0
        Pause 1000
        Lcdout $fe,1,"DIESEL"
        PORTB.2=0
        PORTB.5=0
    Endif
Goto Main

Hopefully, someone who knows PBP can chip in and correct any mistakes in the above.

There is however a slight problem, the DS1620 requires the clock pin pulsing every second to make it do a conversion and set the over temp output. This can also be done by the pic. Do you have a rough circuit diagram.

Mike.
 
Last edited:
Attached is a VERY ROUGH circuit of what I've planned.

What I want, is 2 inputs from 2 X DS1620's set to THERMOSTAT mode, with a HIGH output on pin 5 going into the inputs on the PIC in my case, PORTB.1 and PORTB.4
PORTB.2 AND PORTB.5 are OUTPUTS to transistors switching solenoids

PORTB.6 is an input connected to a pressbutton switch

DOES portb.6 HAVE to have an output?
I'd like it to work so that IF PORTB.1 = 1 AND PORTB.4= 1 AND PORTB.6 = 1 THEN the outputs will be PORTB.2 = 0 and PORTB.5 = 1 but count for 10 seconds and at the end of the ten seconds make PORTB.2 = 0 PORTB.5 = 0

I've left the bit about the LED off this section as I hope from the previous its explained enough

OH forgot to say, clock is a 4Mhz Xtal.
Can this circuit/code be in a "smaller" pic? other than the 16F877 ie one with less lines.


Please go easy on me, bear in mind a week ago I hadn't even considered ever learning how to program a PIC let alone have any idea how to go about it.
 

Attachments

  • PIC Circuit.GIF
    PIC Circuit.GIF
    42 KB · Views: 182
Last edited:
Since your using your DS1620 in thermostat mode (you do have to program them or they don't do much)
Could I suggest a pair (or three) of LM34 or LM35 sensors instead? You can hook them directly to AD0, 1 , 2 and use a TL431 as a +VREF. This will give you accurate sensing on 4 I/O pins.
 
DO ALL inputs HAVE to have an output on a PIC chip, or can you have say 3 inputs but only 2 outputs?
 
Last edited:
Thanks Bill for the suggestion, however I decided on the DS1620's as it reduces component count considerably, and they only have to be programmed once, and the programmer is only a couple of components, and I've already got the program to do it, thats why I chose the DS1620's, I was originally going to go with the LM35's as you may remember from my first attempt using a 555 and various other circuitry that was just messy compared to this (IF I can get it to work)

I've played with the code a bit more, and put it into the PROTON PLUS editor, tried compiling it to see what I get and I've corrected several errors, and I'm down to just 2 errors now. can someone help out please? and let me know even if all errors are gone, do they think it will work? as I've not got a developement board or programmer for PIC's yet, I'm doing all this in my head at the moment and learning as I go

The modified code is:
Code:
DEVICE = 16F877		' We'll use a PIC16F877 PICmicro
	XTAL = 4				' With a 4MHz crystal
' Define LCD pins
Define  LCD_DREG        PORTD
Define  LCD_DBIT        4
Define  LCD_RSREG       PORTE
Define  LCD_RSBIT       0
Define  LCD_EREG        PORTE
Define  LCD_EBIT        1
' Alias pins
RST     var     PORTC.0         ' Reset pin
DQ      var     PORTC.1         ' Data pin
CLK     var     PORTC.3         ' Clock pin
' Allocate variables
temp    var     word            ' Storage for temperature
        Low RST                 ' Reset the device
        ADCON1 = 7              ' Set PORTA and PORTE to digital
        Low PORTE.2             ' LCD R/W line low (W)
        Pause 100               ' Wait for LCD to start
        Lcdout $fe,1, "DIESEL"
		Lcdout $fe,$C0, "Temp in degrees C"  ' Display sign-on message
		
input PORTB.1
output PORTB.2
input PORTB.4
output PORTB.5
input PORTB.6
output PORTB.7

IF PORTB.1 = 1 AND PORTB.4 = 1 AND PORTB.6 = 0  GOTO SOLENOID
ENDIF

IF PORTB.1 = 1 AND PORTB.4 = 1 AND PORTB.6 = 1 GOTO PURGE
ENDIF

' Temploop to read the temperature and display on LCD
Temploop:
        RST = 1                 ' Enable device
        Shiftout DQ, CLK, LSBFIRST, [$ee]       ' Start conversion
        RST = 0

        Pause 1000              ' Wait 1 second for conversion to complete

        RST = 1
        Shiftout DQ, CLK, LSBFIRST, [$aa]       ' Send read command
        Shiftin DQ, CLK, LSBPRE, [temp\9]       ' Read 9 bit temperature
        RST = 0

        ' Display the decimal temperature
        Lcdout $fe,$C0,  dec (temp >> 1), ".", dec (temp.0 * 5), " degrees C"
                Goto Temploop           ' Do it forever

‘PURGE flushes IP pump of oil and replaces it with diesel
Purge:
Output PORTB.2 1  
Output PORTB.5 0   
Lcdout $fe, "FLUSHING"   ;ten second hold before solenoids are set to zero
Pause 1000                    
Output PORTB.2 0  
Output PORTB.5 0  
Lcdout $fe, "Diesel"

‘SOLENOID send outputs to solenoids and display fuel state on LCD
SOLENOID:
Output PORTB.2 1
Output PORTB,5 1
Lcdout $fe, "VEG-OIL"

The ERRORS Are:
Error at Line [30] In file [OILCON~1.BAS] *** THEN directive missing from IF command! ***
Error at Line [31] In file [OILCON~1.BAS] *** Misplaced or Incorrect 'ENDIF'. Also check its corresponding IF Command! ***

ANYONE able to help Please? :)
Anyone know the answer?
 
Last edited:
I don't use PICBASICpro, I take it you bought it because I don't own anything higher than the demo version and it won't compile more than 40 lines of code.

You need a comma ", $C0 ," in line 20 I think.
 
Thanks Bill :)
thats one of the errors I spotted, umm to answer your question, seeing I didnt know anything about programming, and I wasnt willing to pay loads of money just to try something to see if it was easy to learn or not... "I'm borrowing a friends computer who had it installed to see if its worth buying"
 
karenhornby said:
Can this circuit/code be in a "smaller" pic? other than the 16F877 ie one with less lines.

Yes, you could do this with a 18 pin chip. The 16F628 would easily manage it. If you change to something like a 18F1320 then you could use the free C18 or Swordfish compilers.

To answer an earlier question, Pics can have any combination of inputs and outputs. Any pin can be either.

Mike.
 
Think I've cracked it

Hopefully I've done it :)
and
Hopefully someone can confirm this please?

By the way, will the time I've programmed give a 10 second pause/delay?

Here's the code:
Code:
DEVICE = 16F877		' We'll use a PIC16F877 PICmicro
	XTAL = 4				' With a 4MHz crystal
' Define LCD pins
Define  LCD_DREG        PORTD
Define  LCD_DBIT        4
Define  LCD_RSREG       PORTE
Define  LCD_RSBIT       0
Define  LCD_EREG        PORTE
Define  LCD_EBIT        1
' Alias pins
RST     var     PORTC.0         ' Reset pin
DQ      var     PORTC.1         ' Data pin
CLK     var     PORTC.3         ' Clock pin
' Allocate variables
temp    var     word            ' Storage for temperature
        Low RST                 ' Reset the device
        ADCON1 = 7              ' Set PORTA and PORTE to digital
        Low PORTE.2             ' LCD R/W line low (W)
        Pause 100               ' Wait for LCD to start
        Lcdout $fe,1, "DIESEL"
		Lcdout $fe,$C0, "Temp in degrees C"  ' Display sign-on message
		
input PORTB.1   'Input from DS1620 in Thermostat mode (only HIGH or LOW)
output PORTB.2 'OUTPUT to Solenoid 1
input PORTB.4  ' Input from DS1620 in Thermostat mode (only HIGH or LOW)
output PORTB.5 'OUTPUT to Solenoid 2
input PORTB.6   'INPUT from Pushbutton Switch
output PORTB.7

MAIN:
IF PORTB.1 = 1 AND PORTB.4 = 1 THEN TestSolenoid


' Temploop to read the temperature and display on LCD
Temploop:
        RST = 1                 ' Enable device
        Shiftout DQ, CLK, LSBFIRST, [$ee]       ' Start conversion
        RST = 0
        Pause 1000              ' Wait 1 second for conversion to complete
        RST = 1
        Shiftout DQ, CLK, LSBFIRST, [$aa]       ' Send read command
        Shiftin DQ, CLK, LSBPRE, [temp\9]       ' Read 9 bit temperature
        RST = 0
        ' Display the decimal temperature
        Lcdout $fe,$C0,  dec (temp >> 1), ".", dec (temp.0 * 5), " degrees C"
                Goto MAIN           ' Do it forever

‘PURGE flushes IP pump of oil and replaces it with diesel
Purge:
Output PORTB.5  
LOW PORTB.2
Lcdout $fe, "FLUSHING"   ;ten second hold before solenoids are set to zero
Pause 1000   'PAUSES for TEN SECONDS then (HOPEFULLY) SETS OUTPUTS B2 and B5 LOW               
Lcdout $fe, "Diesel"
LOW PORTB.5
LOW PORTB.2

END

‘SOLENOID send outputs to solenoids(Switches fuel supply from Diesel to Veg-Oil)
'and display fuel state on LCD

SOLENOID:
Output PORTB.2 
Output PORTB.5
Lcdout $fe, "VEG-OIL"
GOTO TempLoop

TestSolenoid: 'check to see if PURGE button is pressed
if PORTB.6 = 0 then SOLENOID
if PORTB.6 = 1 then PURGE

I'll try rewriting it to use a 16F628 or 18F1320 instead of the 16F877 (UPDATE DONE BUT)-----HOW can I connect the 3rd DS1620 with these chips though? I'm sure using the DS1620 in 3 wire mode needs a clock signal from the processor?
 
Last edited:
That looks like it would work. I'm not sure why there is an END instruction in the middle of your code and why the compiler didn't throw a wobbly because of it. You might want to add a goto TempLoop at the end of your code incase Portb.6 goes from 1 to zero just before the last line.

Shouldn't the outputs in Solenoid be high or low?

The clocking of the 3rd DS1620 is taken care of by the shiftout and shiftin commands. The clocking of the other two still needs doing. You could connect them to bit 0 of PORTB and toggle it to start the conversion.

Mike.
 
I put the END command there because IF the subroutine PURGE gets called, then the program ends once that section has done its bit.
The other two subroutines end by telling the program to go back to the the TempLoop which basically runs the program again in a loop until once of the subroutines SOLENOID or TestSolenoid is called.
If TestSolenoid is called then the program either starts again via Solenoid, OR
Ends itself after calling the subroutine PURGE

Hopefully that makes sense?
Oh the 1st 2 DS1620's DONT need clocking, they are running in thermostat mode with only a 1 wire output, pin 5 either high or low, only other 2 connections are +5V and 0V (once the temperature thresholds have been programmed into it.

Thanks for the hint about the last line, I've added GOTO TempLoop as the last line
 
Last edited:
2nd Question...

Is there any way of keeping a PIC alive for say 20 seconds after power has been removed?
What I mean is, this circuit I'm TRYING to make, will be connected to the ignition of the car, and once the ignition is turned on it will start.
Once the 2 X DS1620's have reached their preset temperatures they go HIGH which in effect calls the TestSolenoid routine.
NOW IF the ignitions is still on, the solenoids operate until switch S1 is pressed (PORTB.6 goes high) which is fine.

What I want to do IF its at all possible is IF the power to the circuit is interrupted (Ignition going off) BEFORE S1 goes High then another output enables, ie PORTB.7 which could be connected to a siren through a transistor switch to remind me to switch the ignition on and then press the S1 before turning it off again.

I know this MAY be possible if I have a 2nd power to the circuit direct from the car battery and maybe have this power the 5V bus for the PIC, and have the 5V bus for the DS1620's only work when the ignition switch is on. obviously using relays, but this seems messy and I've no idea what the current consumption of the circuit might be it it was left powered up and the car not used for a few weeks

Hope I've made the question sound realistic and not impossible..
 
karenhornby said:
I put the END command there because IF the subroutine PURGE gets called, then the program ends once that section has done its bit.
\Hopefully that makes sense?
Oh the 1st 2 DS1620's DONT need clocking, they are running in thermostat mode with only a 1 wire output, pin 5 either high or low, only other 2 connections are +5V and 0V (once the temperature thresholds have been programmed into it.

The END instruction doesn't stop the program. You need something like Label: goto Label.

The DS1620s in stand alone mode still need a pulse on pin 2 to start the conversion. Refer page 2 of the data sheet.Edit, just read the data sheet and you are correct, if you tie Conv low it will convert continuously.

For your information, this is how I would rearrange your code to make it more readable. This isn't meant as a criticism, it is just that people are familiar with certain ways of doing things.
Code:
MAIN:
    high PORTB.0	'toggle the clock pin.
    Pause 10		'the conversion will be complete 
    Low PORTB.0		'before the inputs are read further down.
    ' Temploop to read the temperature and display on LCD
    RST = 1                 ' Enable device
    Shiftout DQ, CLK, LSBFIRST, [$ee]       ' Start conversion
    RST = 0
    Pause 1000              ' Wait 1 second for conversion to complete
    RST = 1
    Shiftout DQ, CLK, LSBFIRST, [$aa]       ' Send read command
    Shiftin DQ, CLK, LSBPRE, [temp\9]       ' Read 9 bit temperature
    RST = 0
    ' Display the decimal temperature
    Lcdout $fe,$C0,  dec (temp >> 1), ".", dec (temp.0 * 5), " degrees C"
    IF PORTB.1 = 1 AND PORTB.4 = 1 THEN
        if PORTB.6 = 0 then
        'was Solenoid
            HIGH PORTB.2 
            HIGH PORTB.5
            Lcdout $fe,2, "VEG-OIL"
        else
        'was Purge
            HIGH PORTB.5  
            LOW PORTB.2
            Lcdout $fe,2, "FLUSHING"   ;ten second hold before solenoids are set to zero
            Pause 10000   'PAUSES for TEN SECONDS then (HOPEFULLY) SETS OUTPUTS B2 and B5 LOW               
            Lcdout $fe,2, "Diesel"
            LOW PORTB.5
            LOW PORTB.2
        endif
    endif
    Goto MAIN           ' Do it forever

The code above goes in a straight line from top to bottom as this is considered good practice and it makes it easier for others to understand.

Edit, I should add that what you have achieved so far is remarkable considering you haven't programmed before.

Mike.
 
Last edited:
Many thanks :)
I cant claim credit for writing the code, all i did was "borrow" snippets of other peoples code and modified it for my own use, although having said that, it did take a major rewrite and some bits I had to keep trying till it actually worked.
the one thing I'm not certain about is this:
Code:
Lcdout $fe, "FLUSHING"   ;ten second hold before solenoids are set to zero
Pause 1000   'PAUSES for TEN SECONDS then (HOPEFULLY) SETS OUTPUTS B2 and B5 LOW               
Lcdout $fe, "Diesel"

Hopefully if I've done that right it will OUTPUT PORTB.5 AND LOW PORTB.2 for a period of 1t seconds then set both ports LOW


Thanks for the tip about layout of the code, I've taken your advice and its now all neat and tidy :)
HOWEVER would the program not pause endlessly at this point?
Code:
IF PORTB.1 = 1 AND PORTB.4 = 1 THEN
        if PORTB.6 = 0 then
        'was Solenoid
            HIGH PORTB.2 
            HIGH PORTB.5
            Lcdout $fe,2, "VEG-OIL"
        else
'was Purge
            HIGH PORTB.5  
            LOW PORTB.2
            Lcdout $fe,2, "FLUSHING"   ;ten second hold before solenoids are set to zero
            Pause 10000   'PAUSES for TEN SECONDS then (HOPEFULLY) SETS OUTPUTS B2 and B5 LOW               
            Lcdout $fe,2, "Diesel"
            LOW PORTB.5
            LOW PORTB.2
        endif
    endi
Because IF PORTB.6 = 0 then the program will sit there and not loop testing PORTB.6 again??
Thanks
 
Last edited:
The program won't pause endlessly. The way the code works is that the code in blue will only get executed if B.1=1 and B.4=1. Otherwise, it will skip straight to the endif statement at the bottom.
Code:
    IF PORTB.1 = 1 AND PORTB.4 = 1 THEN
[COLOR="Blue"]        if PORTB.6 = 0 then
        'was Solenoid
            HIGH PORTB.2 
            HIGH PORTB.5
            Lcdout $fe,2, "VEG-OIL"
        else
        'was Purge
            HIGH PORTB.5  
            LOW PORTB.2
            Lcdout $fe,2, "FLUSHING"   ;ten second hold before solenoids are set to zero
            Pause 10000   'PAUSES for TEN SECONDS then (HOPEFULLY) SETS OUTPUTS B2 and B5 LOW               
            Lcdout $fe,2, "Diesel"
            LOW PORTB.5
            LOW PORTB.2
        endif[/COLOR]
    endif

As the code in the blue section also contains an IF statement, then if B.6=0 the red section will be executed, otherwise (if B6=1) the green section is executed.
Code:
    IF PORTB.1 = 1 AND PORTB.4 = 1 THEN
        if PORTB.6 = 0 then
[COLOR="Red"]        'was Solenoid
            HIGH PORTB.2 
            HIGH PORTB.5
            Lcdout $fe,2, "VEG-OIL"[/COLOR]
        else
[COLOR="green"]        'was Purge
            HIGH PORTB.5  
            LOW PORTB.2
            Lcdout $fe,2, "FLUSHING"   ;ten second hold before solenoids are set to zero
            Pause 10000   'PAUSES for TEN SECONDS then (HOPEFULLY) SETS OUTPUTS B2 and B5 LOW               
            Lcdout $fe,2, "Diesel"
            LOW PORTB.5
            LOW PORTB.2[/COLOR]
        endif
    endif

Because you don't want it to restart after it has purged you should add a stop of some sort. I suggest waiting for the button to be pressed again so you can restart the sequence if needed.
Code:
    IF PORTB.1 = 1 AND PORTB.4 = 1 THEN
        if PORTB.6 = 0 then
        'was Solenoid
            HIGH PORTB.2 
            HIGH PORTB.5
            Lcdout $fe,2, "VEG-OIL"
        else
        'was Purge
            HIGH PORTB.5  
            LOW PORTB.2
            Lcdout $fe,2, "FLUSHING"   ;ten second hold before solenoids are set to zero
            Pause 10000   'PAUSES for TEN SECONDS then (HOPEFULLY) SETS OUTPUTS B2 and B5 LOW               
            Lcdout $fe,2, "Diesel"
            LOW PORTB.5
            LOW PORTB.2
[COLOR="Blue"]            While(PORTB.6=0)           'wait for button to be pressed again
            Wend                       'this is short for while end[/COLOR]
        endif
    endif

The way the code is indented is to indicate which code goes with which statement. You should be able to look down code and instantly see which "endif" goes with which "if" because they are indented the same.

Hope that makes sense.

Mike.
 
That made perfect sense and I actually understand a bit about how these things work now, even though I've only learnt a few of the commands you can program into them.

Thanks :)
 
Status
Not open for further replies.

Latest threads

Back
Top