![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hi I studied assembly language in college but its been a few years since ive seen it. Could anyone tell me if im on the right track, my syntax is wrong but i just want to know if i remember the principles correctly. The following code is intended to measure the duty cycle of three inputs from an accelerometer. I know its not going to be right but i just want to know if im starting from the very beginning. Thanks
START: INPUT_1: CJNE P1.1, "1", INPUT_1;----------------//WAIT FOR LINE TO GO HIGH SETB T1;-------------------------------//START TIMER LOW: CJNE P1.1, 0, LOW--------------------- //WAIT FOR LINE TO GO LOW MOV T1 @ R0----------------------- //MOVE VALUE ON TIMER TO ADDRESS INC RO -----------------------------//INCREMENT R0 TO CHANGE ADDRESS 2: IF P1.2 = 1;---------------------------//SAME PROCESS FOR 2ND INPUT EN T1 IF P1.2 = 1; MOV T1 @ R0 INC RO 3: IF P1.3 = 1;-----------------------------//SAME PROCESS FOR 3RD INPUT EN T1; IF P1.3 = 1 MOV T1 @ R0 MOV RO, ?-------------------// RESET R0 TO POINT TO ORIGINAL ADDRESS Last edited by paris1; 29th May 2008 at 09:43 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
I would test to see if the line is already high when I enter the routine. example: the INPUT_1: CJNE P1.1, "1", INPUT_1;----------------// may already be high, if its running asynchronously. So IF HIGH wait for LOW, then Start Timer/counter on next HIGH going edge.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
||
|
|
|
|
|
(permalink) |
|
Thanks, thats good advice. hopefully that sort of thing will come back to me
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
I have just written a similar program 'snippet' for two 'accelerometer' inputs, look a 'Atomsoft's recent posts regarding acc, it may help.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 29th May 2008 at 11:04 AM. |
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| PCB track thickness | johnl69 | General Electronics Chat | 4 | 23rd July 2007 10:52 AM |
| Am I on the right track? | Andy1845c | Micro Controllers | 3 | 1st February 2007 01:19 PM |
| Track width 20A | leonel | General Electronics Chat | 9 | 28th October 2005 04:39 PM |
| Antenna PCB track | Scarr | General Electronics Chat | 11 | 29th March 2005 06:50 AM |
| PCB track width ... | jmantilla | General Electronics Chat | 1 | 4th October 2004 12:59 AM |