Problem getting output for pic18f450 to display in hyperterminal

Status
Not open for further replies.

ruben91

Junior Member level 3
Joined
Nov 17, 2014
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
209
i have done with the programming part...i have test with simple program..bur i dont seems to get the wanted output, pls correct me if im wrong

this is my coding


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <p18f4580.h>
#include <usart.h>
#include <delays.h>
 
 
#define RB3_led PORTBbits.RB3  
#define RB2_led PORTBbits.RB2
#define RB0_push_button  PORTBbits.RB0
 
/////Define Function////
void Call_Init_PIC (void);
void Call_Init_USART (void);
 
void main()
{
    TRISBbits.TRISB3=0;
    TRISBbits.TRISB2=0;
    TRISBbits.TRISB0=1;
 
Call_Init_PIC (); // Init the pic18
Call_Init_USART (); // Init USART
 
while (1){  // run forever; infinite loop
RB3_led = 1;
if (RB0_push_button == 0){ // if push button is pressed
while (BusyUSART()); //wait until USART function is free 
putrsUSART("Hello World"); //display "Hello World" on Hyper Terminal
RB2_led = 1; //On the LED
Delay10KTCYx(50); //Delay some time
}
else RB2_led = 0; //Off the LED
}
}
 
void Call_Init_PIC (void)
{
ADCON1 =0x0f;//; all port as digital I/O pins
TRISB = 0b00000001; //set RB0 (push button) as input 
PORTB = 0x00; // Clear port B 
 
}
void Call_Init_USART (){
 
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
25); //Bit per second:9600 / Data bit: 8 / Partiy bit : None / Stop bit : 1 / Flow control : None
 
}

this is the output i gt..as per attached image.

//
im using sk40b with pic18f4580
with mplab ide v8.89 and pickit 2 programer
//

 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…