Problem with WHILE - WEND


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    I programmed my PIC using your .HEX file. Even tho my .HEX file is different, the operation is the same: Oscillator starts with power up, RENCA is low, nothing happens when FOOTSW goes low, but oscillator stops when RENCA goes high. This is my circuit:
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Unhappy Schematic really, really welcome ...

    Hi, Russ

    Having a look to your scheme, I was at the end able to discover you work with inverted I/Os ...

    so ... that gives

    'device: 16F627A master clear is on pin#4 (RA5)


    PORTA = 0
    CMCON = 7 'PortA inputs to be DIGITAL
    TRISA = %00010000 ' port A all outputs, except MCLR is input

    PORTB = %11100000
    TRISB = %00111111 'PORT B ALL INPUT, EXCEPT 6 & 7 OUTPUT

    option_REG = %01111111 'enable weak pullups on port B
    INTCON = %10001000 'Enable Interrupts on PORTB.4-7


    FOOTSW var portb.5 'Foot switch OR CCREADY must be high
    READY var portb.4 'at start

    'FOOTSW var portb.4 '************ On Alan's testboard **************
    'READY var portb.3 ' ************ " **************

    T var word
    J VAR WORD


    RENCA var portb.7 'FREQUENCY OUTPUT TO J1 PIN 13
    EJECT var portb.6 '100 mS PULSE TO J1 PIN 21

    on interrupt goto poo


    START:
    High RENCA : High EJECT

    WHILE READY = 0

    'zzzzzzzzzzzzzzzzzzzz ... waiting !!!
    WEND

    GOTO Start 'GOTO what to do if not ready ???




    DISABLE INTERRUPT

    poo:

    IF FOOTSW THEN false 'we are looking for a Portb.5 interrupt ... not PortB.4 or else

    T = 1' 000 '1mS AT 4 mHZ ...........Note: 1000 for MPSIM or testboard , 1 for real


    freq: ' Note : I Use a blinking Led on my testboard ....

    TOGGLE RENCA
    PAUSE T 'frequency should be 500 Hz (2mS period)

    GOTO freq

    false:

    RESUME
    ENABLE INTERRUPT

    end



    > Renca and Eject have to be initialised to "1" ( not zero ...)

    " IF FOOTSW THEN false 'we are looking for a Portb.5 interrupt ... not PortB.4 or else "

    > The test must work ( jump around 500 Hz generating ) if START is on the "1" State ... not Zero.


    Try to understand what the program does, instead of Copiying it rudely as is ...

    I know it is not so easy ... but try.

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  3. #3
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    I have learned a lot, working on this problem, but the problem was that I had all my configuration fuses enabled (except protection). Thanks to ?wumpus (I forget his handle), I disabled low voltage programming and all is well now.

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 15:46
  2. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 20:12
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 09:12
  4. while wend problem
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 19th March 2007, 03:53
  5. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 23:59

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