Attachment 'ej_system.c'
Download 1 #include <pic/p16f877a.h>
2 #include <system.h>
3 #include <pinio.h>
4 int main(void)
5 {
6 unsigned char dato=0xF0;
7 unsigned char res;
8 //Port B comme sortie
9 ASM("BANKSEL TRISB");
10 ASM("MOVLW 0x00");
11 ASM("MOVWF TRISB");
12 //0xF0 --> PORTB
13 ASM("BANKSEL F_REG");// la donnée se trouve dans la banque de F_REG
14 ASM("MOVF %0,W"::"r" (dato));
15 ASM("BANKSEL PORTB");
16 ASM("MOVWF PORTB");
17 //PORTB --> res
18 ASM("BANKSEL PORTB");
19 ASM("MOVF PORTB,W");
20 ASM("BANKSEL F_REG");//res se trouve en la banque de F_REG
21 ASM("MOVWF %0":"=v" (res));
22 //Quand tu finis d'écrire en assembleur
23 // tu dois toujours le quitter dans la banque de F_REG,
24 //dans le cas contraire le programme ne fonctionnera pas..
25 //Je mets le micro en sommeil
26 sleep();
27 return 0;
28 }
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.