Hallo Leute, Also ich habe folgendes Problem, bin gerade dabei mich mit dem PIC 10f322 vertraut zu machen und hab ein ganz simples Programm geschrieben. Wenn RA2 = 1 dann RA0 & RA 1 Toggeln Wenn RA2 = 0 dann RA0 Toggeln so das Programm funktioniert ABER der RA1 bin hat maximal eine High-Spannung von einem Volt... woran das liegt weiß ich nicht leider darum frage ich euch kennt jemand das Problem? Kann mir jemand helfen? Ich bedanke mich schon mal im voraus!!! :) Code -> MPLABX V.1.95 + XC8 V.1.21
1 | /*
|
2 | * File: Test.c
|
3 | * Author: Martin
|
4 | *
|
5 | * Created on 23. Dezember 2014, 16:21
|
6 | */
|
7 | |
8 | #include <stdio.h> |
9 | #include <stdlib.h> |
10 | #include <xc.h> |
11 | #include <pic.h> |
12 | |
13 | #define _XTAL_FREQ 8000000
|
14 | |
15 | //#pragma config MCLRE = OFF, CP = OFF, WDTE = OFF, FORC = INTRC
|
16 | |
17 | // CONFIG
|
18 | |
19 | #pragma config FOSC = INTOSC // Oscillator Selection bits (INTOSC oscillator: CLKIN function disabled)
|
20 | #pragma config BOREN = OFF // Brown-out Reset Enable (Brown-out Reset disabled)
|
21 | #pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled)
|
22 | #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
|
23 | #pragma config MCLRE = OFF // MCLR Pin Function Select bit (MCLR pin function is digital input, MCLR internally tied to VDD)
|
24 | #pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled)
|
25 | #pragma config LVP = ON // Low-Voltage Programming Enable (Low-voltage programming enabled)
|
26 | #pragma config LPBOR = OFF // Brown-out Reset Selection bits (BOR disabled)
|
27 | #pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.)
|
28 | #pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off)
|
29 | |
30 | /* Pic10F322
|
31 | * _______
|
32 | * RA 0 | | RA 3
|
33 | * ground | | 2 - 5.5V
|
34 | * RA 1 |_______| RA 2
|
35 | */
|
36 | |
37 | |
38 | int main(int argc, char** argv) { |
39 | ANSELA = 0b0000; |
40 | TRISA = 0b1100; |
41 | PORTA = 0b0000; |
42 | |
43 | // PORTA = 0b0000; // Blink 3mal
|
44 | // __delay_ms(10);
|
45 | // PORTA = 0b1111;
|
46 | // __delay_ms(500);
|
47 | // PORTA = 0b0000;
|
48 | // __delay_ms(500);
|
49 | // PORTA = 0b1111;
|
50 | // __delay_ms(500);
|
51 | // PORTA = 0b0000;
|
52 | // __delay_ms(500);
|
53 | // PORTA = 0b1111;
|
54 | // __delay_ms(500);
|
55 | |
56 | while (1) { |
57 | if (PORTAbits.RA2==1){ |
58 | PORTA = 0b0011; |
59 | __delay_ms(100); |
60 | PORTA = 0b0000; |
61 | __delay_ms(100); |
62 | }else{ |
63 | PORTA = 0b0001; |
64 | __delay_ms(100); |
65 | PORTA = 0b0000; |
66 | __delay_ms(100); |
67 | }
|
68 | }
|



