Trying to check port bits, compiles, doesn't work...FIXED

General discussion on mikroBasic for AVR.
Post Reply
Author
Message
woodfold
Posts: 9
Joined: 25 Jul 2008 02:35
Location: Greenville, NC

Trying to check port bits, compiles, doesn't work...FIXED

#1 Post by woodfold » 25 Jul 2008 02:41

Complete newbie here.
I've gotten this code to compile, but it never stops when the bit is set high. Can anyone point out my error?

Code: Select all

program LCD_Test
dim text as char[20]
main:
  DDRB=$00
  Lcd_Init(PORTA,3,2,PORTA,LCD_HI_NIBBLE)
  Lcd_Cmd(LCD_CURSOR_OFF)
  text= "TEST"
  Lcd_Out(1,1,text)
  while true
  PORTB.7 = 0
  Delay_ms(1000)
  Lcd_Cmd(LCD_SHIFT_RIGHT)
  wend
  end.
Last edited by woodfold on 27 Jul 2008 01:27, edited 1 time in total.

woodfold
Posts: 9
Joined: 25 Jul 2008 02:35
Location: Greenville, NC

Re: Trying to check port bit value, compiles, doesn't work

#2 Post by woodfold » 26 Jul 2008 23:10

Turns out PORTB isn't the correct usage.
Here's what did work:

Code: Select all

program LCD_Test
dim text as char[20]
main:
  Lcd_Init(PORTA,3,2,PORTA,LCD_HI_NIBBLE)
  Lcd_Cmd(LCD_CURSOR_OFF)
  text= "TEST"
  Lcd_Out(1,1,text)
  while PINB.7=0 then
  Delay_ms(1000)
  Lcd_Cmd(LCD_SHIFT_RIGHT)
  wend
  end.

Post Reply

Return to “mikroBasic for AVR General”