Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
OK, I am trying to make condition based transmission from let say if 'A' is pressed in keyboard it wil show "jhdghgk" and if 'B' is pressed it should show "kjyhjkdqwefjgtjk" like this....
but the problem is that when i do this on pressing any of key it work but it should match the key to condition then it should show the result this is what i am asking...
I thought we were talking about a pic16f877a!! Where is the keyboard? Are you trying to send a message to the pic from a PC? If so what language did you settle on...
OK, once more.....
i am sending data from PC to uC just single letter like 'A' and the uC will receive the data and test it in if cond and then only uC will send
I am so glad you finally got it working.. good job!
#include <pic.h> // pic specific identifiers
#define _XTAL_FREQ 20000000 // Xtal speed
__CONFIG(0x3F72); // Config bits
unsigned char ch;
unsigned char f;
unsigned char HSerin(void);
void HSerinit(void);
void HSerout(unsigned char f);
unsigned char *a= " Introduction to System Engineering Concepts Open loop and closed loop systems, model classification, performance criterion; Validation and testing of models, mathematical modeling " ;
void main(void) // program entry
{
int index = 0;
ADCON1 = 0x6; // Analogue off
HSerinit();
__delay_ms(150);
while(1) // endless Loop
{
HSerin();
if(RCREG=='b');
{
f = 'a' ;
HSerout(f);
__delay_ms(250);
}
}
}
void HSerinit()
{
TRISC = 0b10000000; // should ideally be set
SPBRG = 129; // 20Mhz xtal 9600 BAUD
TXSTA = 0x24; // TXEN and BRGH
RCSTA = 0x90; // SPEN and CREN
}
void HSerout(unsigned char f) {
while(!TXIF); // Wait for module to finish
TXREG = f; // ready to send
}
unsigned char HSerin()
{ while(!RCIF); // Wait for a character
return RCREG; // return character
}
I have done some changes in original code for testing but not working now also...
You have to fall back to the code that was working and modify it step by step. That is the (only) way you can find out where the problem is
You are not getting me!
i am saying everything is fine but i am not able to know why if cond is not working on pressing any key it work, but it should work/send data when only 'b' is pressed!
You are not getting me! You have to test all the parts of your system separately. You have to test that the key is working. Test your code step by step.. are the functions working properly etc. be brave and creative.. you can figure it out!
Yes key is working on keyboard i have changed to another key and ascii even number is also not working..testing cond is not working
Sound like you need help on debugging. What kind of hardware is that.. point to your previous post if you have already posted a schematic or description. How do you know that the system is not working? What the system should do when it is working?
everything is same....only i am sending data (single character) from terminal window..What kind of hardware is that.. point to your previous post if you have already posted a schematic or description.
there is only pic with UART in it, and PC connected with USB module.How do you know that the system is not working? What the system should do when it is working?
I have told full story now you are asking what was that.. ??
everything is same....only i am sending data (single character) from terminal window..
there is only pic with UART in it, and PC connected with USB module.
at starting when i press any key in keyboard through terminal window it will send to PIC uC and code will test the pressed key and display only when if cond character is matched 'a' like this
then why it is not working???
why if cond is not tested and on pressing any key it is working?
If you are confident that your circuit works.
informing yu that circuit is fine only problem in code i think
I have done some changes in original code for testing but not working now also...
Code:if(RCREG=='b');