sorry for this interruption..
May i ask you sir about our project.? It is a round medicine organizer that will alarm at a specified time that the user set. It's like a pizza pie that has

7 pies (compartment of the medicine). This what we want to happen. When the user select a compartment then select a time (example:8:30am) the pie will

rotate automatically and will stop at the set compartment at 8:30am. It will also produce an alarm sound. Per compartment can be selected up to 6 times

within a day but not at the same time (because the motor will not work at the same time). These are the materials that we're going to used:(1)DC Motor (this

will make the organizer rotate clockwise). (2)quad-7 segment(w/c displays the real time) (3) LCD 16x2 16bit mode (this will display the compartment to

select and the setting of time). (4) 4 PUSH buttons (left & right selector, enter, cancel) (5) Buzzer (for the alarm sound) (6) LDR (sensor that will gives

signal to the motor) (7) mcu PIC16F877A. We are using assembly language in MPLAB. Our big problem is the PROGRAM. We don't know how to start the program

properly. But we have made a program for the LCD (ONLY displays data,,but not manipulating it,,w/c we need most,,since we need to set the time manually on

the LCD using only the 4 pushbuttons. We also have created all the schematic (using eagle software). We have the hardware but not the software. It will be a

great help for us if you'll help us. We are graduating students. We have thought about microcontroller programming but only the basic since its only one

semester & the professor is always absent due to certain circumstances.We see lot of sample codes over the internet & study all. But still we need help.Pls

help us..We're begging you... =(

THIS IS OUR CODE..IT WILL ONLY DISPLAY LETTER "S" FOR THE REASON OF TESTING THE LCD...

#include P16F877A.inc

	__config _XT_OSC & _PWRTE_OFF & _CP_OFF & _WDT_OFF & _DEBUG_OFF & _WRT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF

CTR			EQU 0x0C
LCD_TEMP		EQU 0x0D
DELAY			EQU 0x0E
X_DELAY			EQU 0x0F

LCD_DATA		EQU PORTB
LCD_DATA_TRIS		EQU TRISB
LCD_CTRL		EQU PORTC

#DEFINE LCD_RS LCD_CTRL,2
#DEFINE LCD_RW LCD_CTRL,1
#DEFINE LCD_E LCD_CTRL,0
#DEFINE LCD_PSHBTN PORTA,0

;.......................................................

	ORG 0
	GOTO MAIN

;.......................................................
LCD_INIT
                                    ; Busy-flag is not yet valid
    CLRF        LCD_CTRL            ; ALL PORT output should output Low.
                                    ; power-up delay
    MOVLW       0x01E
    CALL        X_DELAY500          ; 30 * 0.5mS = 15mS
                                    ; Busy Flag should be valid from here
    MOVLW       0x038               ; 8-bit-interface, 2-lines
    CALL        LCD_PUTCMD
    MOVLW       0x000               ; disp.off, curs.off, no-blink
    CALL        LCD_DMODE
    CALL        LCD_CLEAR
    MOVLW       0x004               ; disp.on, curs.off
    CALL        LCD_DMODE
    MOVLW       0x002               ; auto-inc (shift-cursor)
    CALL        LCD_EMODE
    RETURN
;.......................................................
LCD_BUSY
    BSF         STATUS,RP0          ; Select Register page 1
    MOVLW       0x0FF               ; Set PORTB for input
    MOVWF       LCD_DATA_TRIS
    BCF         STATUS, RP0         ; Select Register page 0
    BCF         LCD_RS				; Set LCD for command mode
    BSF         LCD_RW				; Setup to read busy flag
    BSF         LCD_E				; LCD E-line High
    MOVF        LCD_DATA, W         ; Read busy flag + DDram address
    BCF         LCD_E				; LCD E-line Low
    ANDLW       0x80                ; Check Busy flag, High = Busy
    BTFSS       STATUS, Z
    GOTO        LCD_BUSY
LCD_NOTBUSY
    BCF         LCD_RW
    BSF         STATUS, RP0         ; Select Register page 1
    MOVLW       0x000
    MOVWF       LCD_DATA_TRIS       ; Set PORTB for output
    BCF         STATUS, RP0         ; Select Register page 0
    RETURN
;.......................................................
LCD_CLEAR
    MOVLW       0x001
    CALL        LCD_PUTCMD
    RETURN
;.......................................................
LCD_HOME
    MOVLW       0x002
    CALL        LCD_PUTCMD
    RETURN
;.......................................................
LCD_EMODE
    ANDLW       0x003               ; Strip upper bits
    IORLW       0x004               ; Function set
    CALL        LCD_PUTCMD
    RETURN
;.......................................................
LCD_DMODE
    ANDLW       0x007               ; Strip upper bits
    IORLW       0x008               ; Function set
    CALL        LCD_PUTCMD
    RETURN
;.......................................................
LCD_SCGA							; Set CGRam 
    ANDLW       0x03F               ; Strip upper bits
    IORLW       0x040               ; Function set
    CALL        LCD_PUTCMD
    RETURN
;.......................................................
LCD_SDDA							; Set DDRam
    IORLW       0x080               ; Function set
    CALL        LCD_PUTCMD
    RETURN
;.......................................................
LCD_GADDR							; Get Address counter contents
    BSF         STATUS,RP0          ; Select Register page 1
    MOVLW       0x0FF               ; Set PORTB for input
    MOVWF       LCD_DATA_TRIS
    BCF         STATUS, RP0         ; Select Register page 0
    BCF         LCD_RS    			; Set LCD for command mode
    BSF         LCD_RW    			; Setup to read busy flag
    BSF         LCD_E     			; LCD E-line High
    MOVF        LCD_DATA, W         ; Read busy flag + RAM address
    BCF         LCD_E     			; LCD E-line Low
    ANDLW       0x07F               ; Strip upper bit
    BCF         LCD_RW
    BSF         STATUS, RP0         ; Select Register page 1
    MOVLW       0x000
    MOVWF       LCD_DATA_TRIS       ; Set PORTB for output
    BCF         STATUS, RP0         ; Select Register page 0
    RETURN
;.......................................................
LCD_PUTCHAR
    MOVWF       LCD_TEMP             ; Character to send is in W
    CALL        LCD_BUSY             ; Wait for LCD to be ready
    BCF         LCD_RW				 ; Set LCD in read mode
    BSF         LCD_RS				 ; Set LCD in data mode
    BSF         LCD_E				 ; LCD E-line High
    MOVF        LCD_TEMP, W
    MOVWF       LCD_DATA             ; Send data to LCD
    BCF         LCD_E				 ; LCD E-line Low
    RETURN
;.......................................................
LCD_PUTCMD
    MOVWF       LCD_TEMP             ; Command to send is in W
    CALL        LCD_BUSY             ; Wait for LCD to be ready
    BCF         LCD_RW    			 ; Set LCD in read mode
    BCF         LCD_RS    			 ; Set LCD in command mode
    BSF         LCD_E     			 ; LCD E-line High
    MOVF        LCD_TEMP, W
    MOVWF       LCD_DATA            ; Send data to LCD
    BCF         LCD_E     			; LCD E-line Low
    RETURN
;.......................................................
;a 500uS delay @ 4MHz X-tal
DELAY500
    MOVLW       D'165'              ; +1        1 cycle
    MOVWF       DELAY               ; +2        1 cycle
DELAY500_LOOP
    DECFSZ      DELAY, F            ; step1     1 cycle
    GOTO        DELAY500_LOOP       ; step2     2 cycles
DELAY500_END
    RETURN                          ; +3        2 cycles
;........................................................
;a delay of 'W' * 500mS
X_DELAY500
    MOVWF       X_DELAY             ; +1        1 cycle
X_DELAY500_LOOP
    CALL        DELAY500            ; step1     wait 500uSec
    DECFSZ      X_DELAY, F          ; step2     1 cycle
    GOTO        X_DELAY500_LOOP     ; step3     2 cycles
X_DELAY500_END
    RETURN                          ; +2        2 cycles

;.......................................................
MAIN			BSF STATUS,RP0
			BCF STATUS,RP1
			MOVLW 0x00
			MOVWF LCD_DATA
			MOVLW 0x00
			MOVWF LCD_CTRL
			MOVLW 0x01
			MOVWF PORTA
			BCF STATUS,RP0

			MOVLW 0x06
			MOVWF ADCON1

			CALL LCD_INIT

			MOVLW ' '
			MOVWF LCD_PUTCHAR
			MOVLW 'S'
			MOVWF LCD_PUTCHAR

;.................................................
       END

We want to make a delay after displaying a certain message for about 5 3seconds (example: your medicine organizer...) After displaying it for 3 seconds, it will show the word compartment on the 1st line of LCD...then on the 2nd line @ the center is number "1" (we want it to change as 1-6). We don't know how can we manipulate it using PIC16F877A and push buttons for selection (left and right). We are stock on this part of the program. (HOW TO SELECT 1-6 USING A PUSH BUTTON, MCU & LCD W/O MOVING THE CURSOR?). Another problem that we've got is HOW WE CAN CONTROL THE MOTOR WITH OUR PROGRAM?and stop it when the time that we have set is equal to the quad 7-segment real time?

We want to make a delay after displaying a certain message for about 5 OR 3seconds (example: your medicine organizer...) After displaying it for 3 seconds, it will show the word compartment on the 1st line of LCD...then on the 2nd line @ the center is number "1" (we want it to change as 1-6). We don't know how can we manipulate it using PIC16F877A and push buttons for selection (left and right). We are stock on this part of the program. (HOW TO SELECT 1-6 USING A PUSH BUTTON, MCU & LCD W/O MOVING THE CURSOR?). Another problem that we've got is HOW WE CAN CONTROL THE MOTOR WITH OUR PROGRAM?and stop it when the time that we have set is equal to the quad 7-segment real time?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.