Agentsmith15 wrote: |
Could you also post the source code's as ASM, and preferable in the MASM format? |
Agentsmith15 wrote: |
Could you also post the source code's as ASM, and preferable in the MASM format? |
Code: |
// Stats: // // ROM used: 120 (12%) // Largest free fragment is 904 // RAM used: 7 (10%) at main() level // 7 (10%) worst case // Stack: 1 locations // * 0000: MOVLW 00 0001: MOVWF 0A 0002: GOTO 03B 0003: NOP .................... #include <16F84A.h> .................... #device PIC16F84A .................... #list .................... .................... #use delay(clock=10000000) .................... #fuses NOWDT,HS, NOPUT, NOPROTECT .................... #use rs232(baud=1200,parity=N,xmit=PIN_A2,rcv=PIN_A3,bits=9) .................... .................... // prototypes .................... void clockwait(void); .................... .................... unsigned char val; .................... .................... void main() .................... { * 003B: CLRF 04 003C: MOVLW 1F 003D: ANDWF 03,F 003E: CLRF 0E 003F: BSF 03.5 0040: BCF 05.2 0041: BCF 03.5 0042: BSF 05.2 .................... unsigned char t; // Loop control variable .................... unsigned char byt; // Holds each byte received .................... .................... setup_counters(RTCC_INTERNAL,RTCC_DIV_1); 0043: MOVLW 08 0044: MOVWF 0C 0045: BTFSS 0C.3 0046: GOTO 04F 0047: MOVLW 07 0048: CLRF 01 0049: MOVLW 81 004A: MOVWF 04 004B: MOVF 00,W 004C: ANDLW C0 004D: IORLW 0F 004E: MOVWF 00 004F: CLRWDT 0050: MOVLW 81 0051: MOVWF 04 0052: MOVF 00,W 0053: ANDLW C0 0054: IORWF 0C,W 0055: MOVWF 00 .................... .................... while(1) // Loop forever... .................... { .................... byt=0; // Starting a new data frame 0056: CLRF 11 .................... .................... clockwait(); // Ignore start bit 0057: CALL 004 .................... for(t=0;t<8;t++) // Grab eight bits of data... 0058: CLRF 10 0059: MOVF 10,W 005A: SUBLW 07 005B: BTFSS 03.0 005C: GOTO 071 .................... { .................... clockwait(); 005D: CALL 004 .................... byt|=input(PIN_A0)<<t; 005E: BSF 03.5 005F: BSF 05.0 0060: MOVLW 00 0061: BCF 03.5 0062: BTFSC 05.0 0063: MOVLW 01 0064: MOVWF 0C 0065: MOVF 10,W 0066: MOVWF 0D 0067: BTFSC 03.2 0068: GOTO 06D 0069: BCF 03.0 006A: RLF 0C,F 006B: DECFSZ 0D,F 006C: GOTO 069 006D: MOVF 0C,W 006E: IORWF 11,F .................... } 006F: INCF 10,F 0070: GOTO 059 .................... clockwait(); // Ignore parity bit 0071: CALL 004 .................... clockwait(); // Ignore stop bit 0072: CALL 004 .................... .................... putc(byt); // Send byte to the transmitter 0073: MOVF 11,W 0074: MOVWF 12 0075: GOTO 00F .................... .................... } // ... rinse and repeat :) 0076: GOTO 056 .................... } .................... 0077: SLEEP .................... void clockwait(void) .................... { .................... // Waits for the next clock cycle... .................... while(!input(PIN_A1)); // Wait for clock to go HI * 0004: BSF 03.5 0005: BSF 05.1 0006: BCF 03.5 0007: BTFSS 05.1 0008: GOTO 004 .................... while(input(PIN_A1)); // Wait for clock to go LO 0009: BSF 03.5 000A: BSF 05.1 000B: BCF 03.5 000C: BTFSC 05.1 000D: GOTO 009 000E: RETLW 00 .................... } .................... 000F: BSF 03.5 0010: BCF 05.2 0011: BCF 03.5 0012: BCF 05.2 0013: MOVLW 09 0014: MOVWF 0D 0015: NOP 0016: NOP 0017: NOP 0018: BSF 0D.7 0019: GOTO 02B 001A: BCF 0D.7 001B: RLF 0E,W 001C: DECFSZ 0D,W 001D: RRF 12,F 001E: BTFSC 03.0 001F: BSF 05.2 0020: BTFSS 03.0 0021: BCF 05.2 0022: BSF 0D.6 0023: GOTO 02B 0024: BCF 0D.6 0025: DECFSZ 0D,F 0026: GOTO 01B 0027: NOP 0028: NOP 0029: NOP 002A: BSF 05.2 002B: MOVLW 02 002C: MOVWF 0C 002D: CLRF 04 002E: DECFSZ 04,F 002F: GOTO 02E 0030: DECFSZ 0C,F 0031: GOTO 02D 0032: MOVLW AD 0033: MOVWF 04 0034: DECFSZ 04,F 0035: GOTO 034 0036: BTFSC 0D.7 0037: GOTO 01A 0038: BTFSC 0D.6 0039: GOTO 024 003A: GOTO 076 (RETURN) Configuration Fuses: Word 1: 3FFA HS NOWDT NOPUT NOPROTECT |
Code: |
:1000000000308A003B280000831685148312851C6B :100010000428831685148312851809280034831652 :1000200005118312051109308D0000000000000049 :100030008D172B288D130E0D0D0B920C0318051523 :10004000031C05110D172B280D138D0B1B28000009 :1000500000000000051502308C008401840B2E285E :100060008C0B2D28AD308400840B34288D1B1A286E :100070000D1B2428762884011F3083058E018316EA :1000800005118312051508308C008C1D4F28073090 :100090008101813084000008C0390F38800064007D :1000A000813084000008C0390C04800091010420D4 :1000B00090011008073C031C7128042083160514C6 :1000C00000308312051801308C0010088D000319D0 :1000D0006D2803108C0D8D0B69280C089104900A73 :1000E000592804200420110892000F285628630084 :02400E00FA3F77 :00000001FF |
luck___ wrote: |
Would it be possible to implement the project using LC series http://www.linxtechnologies.com/interface.php?section=products&category=rf_modules&subcategory=lc_series or LR series http://www.linxtechnologies.com/interface.php?section=products&category=rf_modules&subcategory=lr_series of chips as these are considerably cheaper (student budget :cry: )
The LC series looks very attractive but it only offers 5kbps, would this be sufficient? |
bigal2 wrote: |
Hi,
sorry to resurrect such an old thread but i am interested in building one of these things. I have the following transmitter / reciever module: http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=7515473139 which should do the job i think, however my concerns are that i cant find a 16F87 pic, planty of 16F87x (x can be 1,4,7 etc) and i have 2 16f877 (40DIP) controllers i can use, but will it work. Also does the 16F87 code work, has anyone tried it? thanks Alex. :? |
phreakre wrote: |
First of all, that is a great tutorial and kudos to you for putting it together in a readable, understandable format for a hardware novice [namely me ]. |
phreakre wrote: |
I have a quick question regarding hardware in the US. You mention that the *418 or *433 parts based on being in the UK or the rest of Europe, do you have any advice for someone in the US? |
output generated using printer-friendly topic mod, All times are GMT + 2 Hours