Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help on programming in c++....

Status
Not open for further replies.

ooicheesan

Junior Member level 1
Junior Member level 1
Joined
Sep 28, 2004
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
353
<p18f252.h> openusart

:) Hello..i am currently doing programming using c language to enable my PICDEM 2 PLUS DEMO BOARD to receive data through rs232 from vb..so can you send me a sample program to enable the serial communication between the vb and also the board? This attachment is what i done so far...
 

:oops: ..I am using c++ to write the .c source to enable it to run in mplab/....so i got to configure the usart and then compile the usart then after compilation..when i trying to run and program it to the pic18f252 board..there is error msg pop up..[ICD0083: Target not in debug mode, unable to perform operation]..can you help?this is my program in mplad..


#include <p18f252.h>
#include <usart.h>
#include <usart.h>

void main(void)
{
// configure USART
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_OFF & //usart configuration
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,25 );
putcUSART(0x0D); //hex number for enter

while(1)
{
PORTA=1; //PORTA and TRISA input configuration
TRISA=255;

PORTB=0; //PORTB and TRISB output configuration
TRISB=0;

PORTC=1; //PORTC and TRISC input configuration
TRISC=255;

if(PORTA==0) //no input
{
PORTA=0;
//TRISB=0x00 //no LED light up
}
else if(PORTA==1)
{
PORTA=1;
//TRISB=PORTA //takes input from port A
}
else if(PORTA==2)
{
PORTA=2; //pushbutton pressed
}

else if(PORTA==3)
{
PORTA=3;
}
else if(PORTA==4)
{
PORTA=4;
}
else if(PORTA==5)
{
PORTA=5;
}
else if(PORTA==6)
{
PORTA=6;
}
else if(PORTA==7)
{
PORTA=7;
}
else if(PORTA==8)
{
PORTA=8;
}

}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top