flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 28 Oct 2012, 04:59
Is this a homework assignment?
|
|||
![]() |
|
Carl03 28 Oct 2012, 05:10
It's a project I'm working on for University yes. I am struggling with how to start the code and I can't wait to get it working so I can see it in action.
|
|||
![]() |
|
revolution 28 Oct 2012, 07:11
I suggest that the first thing you need to figure out is the timing. Get an interrupt routine working based upon a fixed period (one second perhaps) and have it do something simple like toggle an LED on/off each interrupt. Then up the interrupt rate to do a scan across the three sets of LEDs until they look like they are on but dimmer. Once that is working and debugged then you can add the actual RTC counting code. And then later add the button detection code which could be handled by the main loop.
|
|||
![]() |
|
edfed 29 Oct 2012, 04:14
you first need a real timing to trigger the interrupt using a quartz.
do you have source code to start? cause if you didn't started to code, what can we do for you? the full diagram can help too to code something. |
|||
![]() |
|
shoorick 29 Oct 2012, 07:45
i'm not experienced on PICs, but seems it is a similar project:
http://www.obelisk.demon.co.uk/electronics/clock.html |
|||
![]() |
|
Carl03 21 Nov 2012, 11:39
I've completed everything and works fine. My buttons are to set the hours and minutes. My hours set button is connected to RA3 and minutes set button is connected to RA4 and this also resets the seconds. I've written a bit of code but when I start the program, it scrolls through the hours fast (very fast) until I press the hours set button does the same with minutes
Code: check_delay: incf debounce, f movf debounce, w sublw .255 skpweq goto check_delay clrf debounce goto check_buttons check_buttons: movf PORTA, w movwf buttons btfss buttons,4 goto check_end btfss buttons, 3 btfss buttons, 4 goto set_hours goto set_min set_hours: btfss buttons, 3 goto check_end incf hour, f movf hour, w sublw d'24' skpweq goto show_hour clrf hour show_hour: movf hour, w movwf hour bsf T2CON, TMR2ON return set_min: incf min, f movf min, w sublw d'60' skpweq goto show_min clrf min show_min: movf min, w movwf min check_end: bsf T2CON, TMR2ON return
|
|||||||||||
![]() |
|
gunblade 26 Nov 2012, 11:41
Based on your circuit diagram, your buttons are active-low, and therefore the associated PORTA bit would be set if the button is not pressed, and clear if the button is currently being pressed.
Your check_buttons function looks.. strange. I dont know why you're trying to do an early-exit based on the value of RA4 - then checking whether RA3 and RA4 are pressed. Why not just use something like: Code: check_buttons: movf PORTA,w movwf buttons btfss buttons,4 goto set_min btfss buttons,3 goto set_hours goto check_end FYI: You dont need to read PORTA into a variable first, you could simply use PORTA directly in all your btfss functions. It would save you quite a few instructions, as well as a byte in RAM. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.