Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4787

owout not working on 16f77 ? (hangs)

$
0
0
no matter what I do, I cannot get owout to work on these 16f77's.

works on 12f683 (used to read the serial numbers)
tried it on other 16f's and always worked perfectly.

this works on 16f917:
Code:

x var byte

clear
start:
while x < 50
x = x + 1
debug "looping",dec2 x,$0d,$0a
wend
x=0

debug "attempting one wire out" ,$0d,$0a
owout portb.2, 1, [$CC, $4E, 0, 0, %01111111]  'set resolution of sensor
debug "passed one wire out" ,$0d,$0a
goto start

but the same thing on 16f77 will hang at the owout command no matter what I do.
checked ports for analog/comparators (adcon1/ccp1con/ccp2con), switched to all different ports, even the same one driving lcd, different boards,etc..
I'm starting to think there's some glitch that just makes it not compatible with 16f77?


I would just use one of the other pics, but I have these old head units (lcd, buttons, etc) that
have 16f77's on the board.

stripped down to just this:
Code:

@ __CONFIG  _BODEN_ON & _CP_OFF & _PWRTE_ON & _WDT_ON & _HS_OSC

DEFINE OSC 16

ADCON1 = 7


        DEFINE LCD_DREG        PORTD
        DEFINE LCD_DBIT        0
        DEFINE LCD_RSREG PORTC
        DEFINE LCD_RSBIT 3
        DEFINE LCD_EREG        PORTC
        DEFINE LCD_EBIT        5
        DEFINE LCD_BITS        8
        DEFINE LCD_LINES 4
        DEFINE LCD_COMMANDUS 2000
        DEFINE LCD_DATAUS 50
       

start:       
        LCDOUT $fe,1
    Pause 750      ' Wait for LCD to startup
'lcd width guide  "12345678901234567890"
    Lcdout $fe,1,  "                    "
    LCDOUT $fe,$94,"                    "
    LCDOUT $FE,$C0,"    Fridge Alert!  " ' goto start line 3
    lcdout $fe,$D4,"                    "
    pause 5000
    LCDOUT $FE,1

    pause 500
    lcdout $FE,1,"set resolution owout"   
      'OWOUT portb.2, 1, [$CC, $4E, 0, 0, %01111111]  'set resolution of sensor
    lcdout $FE,$D4,"success!"
    pause 5000
goto start

stops right after displaying "set resolution owout"..
nothing, just dead stops.
(here i commented out the owout line and it proceeds to success etc..)

Any ideas?

Viewing all articles
Browse latest Browse all 4787

Trending Articles