Регистрация | Вход

[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 2 из 2
  • «
  • 1
  • 2
Модератор форума: ivan_fd  
Форум Picbasic.ru » Программирование МК » PicBasicPro » Реализация меню на LCD (Pic16f877 + LCD 2x16)
Реализация меню на LCD
chiper Дата: Сб, 20.11.2010, 01:35  |                                                                                                                Сообщение # 16
Группа: Проверенные
Ранг:  Продвинутый
Сообщений: 108
Репутация: 4   ±
Замечания:   ±
На сайте с 14.07.2010

Статус: Offline

действительно.... только у них это не реализовано на микроконтроллере wink

Ех.. в этом есть что то обидное... уже не в 1 раз додумываюсь до того, что уже до меня придумали на западе.... sad
Конечно у моей конструкции чуть иная спецификация... но принцип работы "гелиостата" идентичен....

Кст. я закончил проект и дописал окончательно прогу, если кому то интересно, то могу разместить проект в статьях после нового года когда время будет свободное...

Вот доарботал кусок отвечающий за работу гелиостата. Даже маленько облегчил программу

Code
if on_geleostat = 1 Then  

          pot 4,250,b1
          pot 5,250,b0                     
          pot 7,250,b11   
          pot 6,250,b00      
           
          if b1  - b0  <= 100 then portc.4 = 0 : portc.5 = 0               
          if b11 - b00 <= 100 then portc.6 = 0 : portc.7 = 0   
          if b0  - b1  <= 100 then portc.4 = 0 : portc.5 = 0               
          if b00 - b11 <= 100 then portc.6 = 0 : portc.7 = 0  

          if b0 > b1 then                     
            c0 = b0 - b1                     
              if c0 > 150 then                     
                 portc.4 = 1                     
                 portc.5 = 0     
              else  
                 portc.4 = 0                      
                 portc.5 = 0  
              endif  
          endif  
           
                    

          if b00 > b11 then                      
            c00 = b00 - b11                      
              if c00 > 150 then                       
                 portc.6 = 1                     
                 portc.7 = 0     
              else  
                 portc.7 = 0                     
                 portc.6 = 0  
              endif  
          endif  
            

          if b0 < b1 then    
              c0 = b1 - b0     
              if c0 > 150 then  
                portc.5 = 1     
                portc.4 = 0   
              else  
                portc.4 = 0  
                portc.5 = 0  
              endif  
           endif   
         
          if b00 < b11 then    
              c00 = b11 - b00     
              if c00 > 150 then  
                portc.7 = 1     
                portc.6 = 0   
              else  
                portc.6 = 0  
                portc.7 = 0  
              endif  
          endif  
           
            
  endif
  goto ifbuttonmenu


Как бы ты хорошо не паял, твой девайс на микроконтроллере без прошивки будет просто куском железа.
Сообщение отредактировал chiper - Сб, 20.11.2010, 01:50
DNM Дата: Вт, 04.10.2011, 23:31  |                                                                                                                Сообщение # 17
Группа: Проверенные
Ранг:  Понимаю
Сообщений: 75
Репутация: 0   ±
Замечания:   ±
На сайте с 29.09.2011

Статус: Offline

Pause 500 ' Wait for LCD to startup
Lcdout $fe, 1 ' Clear LCD screen
Lcdout " *** RunTime ***"
loop:
if portb.4 = 1 then goto clock1
pause 5
if portb.5 = 1 then goto a1
pause 5
if portb.6 = 1 then goto a2
pause 5
goto loop
'--------------------------------------------------------------------
a1:
if portb.5 = 1 then RTCHour=RTCHour+1
'if portb.6 = 1 then RTCHour=RTCHour-1
if RTCHour>24 then RTCHour=0
if RTCHour<0 then RTCHour=0
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "RTCHour:", dec2 RTCHour
Pause 500 ' Wait .5 second
if portb.4 = 1 then goto a2 'переход на минуты
pause 5
goto a1
'--------------------------------------------------------------------
a2:
if portb.5 = 1 then RTCMin=RTCMin+1
'if portb.6 = 1 then RTCMin=RTCMin-1
if RTCMin>60 then RTCMin=0
if RTCMin<0 then RTCMin=0
Lcdout $fe, 1
Lcdout "RTCMin:", dec2 RTCMin
Pause 500 ' Wait .5 second
if portb.4 = 1 then goto a3 'переход на секунды
goto a2
'--------------------------------------------------------------------
a3:
if portb.5 = 1 then RTCSec=RTCSec+1
'if portb.6 = 1 then RTCSec=RTCSec-1
if RTCSec>60 then RTCSec=0
if RTCSec<0 then RTCSec=0
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "RTCSec:", dec2 RTCSec
Pause 500
if portb.4 = 1 then goto a4 'переход на установку года
goto a3
'--------------------------------------------------------------------
a4:
if portb.5 = 1 then RTCYear=RTCYear+1
'if portb.6 = 1 then RTCYear=RTCYear-1
if RTCYear>99 then RTCYear=0
if RTCYear<0 then RTCYear=0
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "RTCYear:", dec2 RTCYear
Pause 500
if portb.4 = 1 then goto a5 'переход на установку месяца
goto a4
'--------------------------------------------------------------------
a5:
if portb.5 = 1 then RTCMonth=RTCMonth+1
'if portb.6 = 1 then RTCMonth=RTCMonth-1
if RTCMonth>12 then RTCMonth=1
if RTCMonth<1 then RTCMonth=1
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "RTCMonth:", dec2 RTCMonth
Pause 500
if portb.4 = 1 then goto a6 'переход на установку дня
goto a5
'--------------------------------------------------------------------
a6:
if portb.5 = 1 then RTCDate=RTCDate+1
'if portb.6 = 1 then RTCDate=RTCDate-1
if RTCDate>31 then RTCDate=1
if RTCYear<1 then RTCYear=1
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "RTCDate:", dec2 RTCDate
Pause 500
if portb.4 = 1 then goto clock 'переход на установку часов
goto a6
'--------------------------------------------------------------------


Более подробно здесь: http://asemlab.net/
Форум Picbasic.ru » Программирование МК » PicBasicPro » Реализация меню на LCD (Pic16f877 + LCD 2x16)
  • Страница 2 из 2
  • «
  • 1
  • 2
Поиск: