Hallo Leute,
Ich bin ein absoluter Frischling was Microcontroller angeht! Vor einer
Woche wusste ich nichtmal was Microcontroller sind...
Ich habe einen PIC24FJ64GB002 Kit. Ich versuche über UART an Putty eine
Nachricht zu schicken aber das will einfach nicht hinhauen. Ich habe mir
die Header Dateien von MPLAB angeschaut und alles so gemacht wie es drin
beschrieben ist. Das was nicht beschrieben war habe ich mir ergooglet.
Wo sind hier meine Fehler?
1 | #define SYSCLK 16000000UL /*!< SYSCLK frequency in Hz */
|
2 | #define UART_BAUDRATE 19200UL
|
3 |
|
4 | #include <stdio.h>
|
5 | #include <stdlib.h>
|
6 | #include <string.h>
|
7 | #include <uart.h>
|
8 |
|
9 | #include <p24FJ64GB002.h>
|
10 | #include <PPS.h>
|
11 | #include <adc.h>
|
12 | #include <libpic30.h>
|
13 |
|
14 | #include "genericTypeDefs.h"
|
15 |
|
16 |
|
17 |
|
18 | _CONFIG1( WDTPS_PS1 & FWPSA_PR32 & WINDIS_OFF & FWDTEN_OFF & ICS_PGx1 & GWRP_OFF & GCP_OFF & JTAGEN_OFF )
|
19 | _CONFIG2( POSCMOD_NONE & I2C1SEL_SEC/*I2C1SEL_PRI*/ & IOL1WAY_OFF & OSCIOFNC_ON & FCKSM_CSDCMD & FNOSC_FRCPLL & PLL96MHZ_ON & PLLDIV_NODIV & IESO_ON)
|
20 | _CONFIG3( WPFP_WPFP0 & SOSCSEL_IO & WUTSEL_LEG & WPDIS_WPDIS & WPCFG_WPCFGDIS & WPEND_WPENDMEM )
|
21 | _CONFIG4( DSWDTPS_DSWDTPS3 & DSWDTOSC_LPRC & RTCOSC_SOSC & DSBOREN_OFF & DSWDTEN_OFF )
|
22 |
|
23 |
|
24 |
|
25 | void main(){
|
26 |
|
27 | char test[50] = "Hallo! Ich bin ein PIC";
|
28 |
|
29 | AD1PCFG = 0xFFFF;
|
30 |
|
31 |
|
32 | TRISBbits.TRISB10 = 0; // Configure the TX pin (RB10)
|
33 | TRISBbits.TRISB11 = 1; // Configure the RX pin (RB11)
|
34 |
|
35 | PPSUnLock; // Unlock the PPS functionality
|
36 |
|
37 | // Configure UART PPS pins
|
38 | // Assign the Uart RX function to the correct pin
|
39 | iPPSInput( IN_FN_PPS_U1RX, IN_PIN_PPS_RP10 );
|
40 |
|
41 | // Assign the Uart Tx function to the correct pin
|
42 | iPPSOutput( OUT_PIN_PPS_RP11, OUT_FN_PPS_U1TX );
|
43 |
|
44 | PPSLock; // Lock the PPS functionality
|
45 | UART_UEN_10;
|
46 | UART_1STOPBIT;
|
47 | UART_NO_PAR_8BIT;
|
48 | UART_TX_ENABLE;
|
49 | UART_EN;
|
50 |
|
51 | putcUART1(*test);
|
52 |
|
53 |
|
54 | }
|
Ich hoffe nur, dass ich nicht alles falsch gemacht habe!