![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
i was connecting rs232 DB9 to PIC16f877A and using hyperterminal to show the data. it only work when i keep on switching on and off power supply. it was no respond when i switch on the powerr supply constanly. anyone can tell me what is the problem ? below is my programming code. unsigned short temp_res; void main() { USART_Init(19200); ADCON1 = 0; TRISA = 0xFF; do { temp_res = ADC_Read(2) >> 2; USART_Write(temp_res); Delay_ms(100); } while (1); } | |
| |
| | #2 | |
| Quote:
the while (1) at the end just loops there, so your program will run once and sit at the loop (if I remember correctly). Last edited by binzer; 11th June 2009 at 05:49 PM. | ||
| |
| | #3 |
|
so did you mean i have to change my program from do{ ..... } while (1); to while (1) { ..... }; it doenst work when i connected rs232 pin 2 (Rx) to MAX232 pin 14(T1out) without moving. it work only when rs232 pin (Rx) keep on touching and removing from MAX232 pin 14(T1out). once pin 2 touched pin 14, hyperterminal will shows the data then stop. to receive data continuously, i have to keep on touching and removing the pin. do you know what is the problem ? | |
| |
| | #4 | |
| Quote:
Do you have decoupling caps on the pic and MAX232? Is your power supply clean (noise)? | ||
| |
| | #5 |
|
this is my schematic. it only work when i unground pin 15. i also found that my hyperterminal received data without pic16f877. actually hyperterminal should not receive any data without pic16f877 am i right ?
| |
| |
| | #6 | |
| Quote:
Code: do {
temp_res = ADC_Read(2) >> 2;
USART_Write(temp_res);
Delay_ms(100);
} while (1);
Code: void Usart_Write(unsigned short data); You can either use printf which has the ability to convert you number to a string (ie 65 becomes the char 6 followed by the char 5) or itoa (int to ascii) to get a string of characters and use Usart_Write to send each out in order. Both of these are somewhat compiler dependant and there is no mention of which complier you are using. I did not look at the schematic.
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) | ||
| |
| | #7 | |
| Quote:
Mike. | ||
| |
| | #8 | |
| Quote:
unsigned short temp_res; void main() { USART_Init(19200); // Initalize USART (19200 baud rate, 1 stop bit, no parity...) // Select Vref and analog inputs, in order to use ADC_Read ADCON1 = 0; // All PORTA pins as analog, VDD as Vref TRISA = 0xFF; // PORTA is input do { temp_res = ADC_Read(2) ; USART_Write(temp_res); // Send ADC reading as byte Delay_ms(100); } while (1); // endless loop } | ||
| |
| | #9 |
|
my circuit is currently working. the previous problems have been solved by changing capacitors and clock of pic16f877a and the program still remain the same. now i want to add Rf transmitter to pin RC6/Tx (pic16f877a) in order to transmit program to another computer using hyperterminal. please let me know if i am wrong. i hope can receive some comments from seniors again. thanks | |
| |
| | #10 | |
| Quote:
| ||
| |
| | #11 | |
| Quote:
Mike. | ||
| |
| | #12 |
| if i use hyperterminal, do i need to use manchester coding again? or i can just direct send data without manchester coding by hyperterminal ? can you give some examples as references for me ? i am using mikroC compiler currently.
| |
| |
| | #13 | |
| Quote:
Mike. Check this thread.. RF module interface with PIC Also here is a chip that does the job and can be used on both ends. http://www.rfmodules.com.au/rm/products/ctr124.htm Last edited by binzer; 15th June 2009 at 12:07 PM. | ||
| |
| | #14 |
|
Forget about radio until after you have it working with wires (RS232). Neither of you have fixed the problem I pointed out in my previous post.
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) | |
| |
| | #15 |
| | |
| |
|
| Tags |
| problem, rs232 |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Firefly 16F88 RS232 problem | futz | Micro Controllers | 6 | 23rd February 2008 01:04 PM |
| AVR DDS ~ RS232 problem... | krazatchu | AVR | 15 | 13th December 2007 05:44 AM |
| rs232 problem | handsprince | General Electronics Chat | 8 | 23rd April 2006 01:04 PM |
| Problem When Hooking RS232 Through A Y-Adapter ? | iso9001 | General Electronics Chat | 2 | 16th March 2005 12:31 PM |
| PIC Basic Plus and RS232 problem again. Help!!! | Beefer3 | Micro Controllers | 1 | 15th November 2003 12:08 AM |