View previous topic :: View next topic |
Author |
Message |
scanan
Joined: 13 Aug 2004 Posts: 73 Location: Turkey
|
|
Posted: Fri May 09, 2025 7:53 am |
|
|
temtronic wrote: | curious....
you've made several changes so could you please post the program and the printout ?
thanks |
set_tris_a(0b00001000); //0x08
set_tris_b(0b11000100); //0xC4
set_tris_c(0b10100000); //0xA0
set_tris_d(0b00000000); //0x00
set_tris_e(0b00001000); //0x08
TX and RX are situated at pinc6 and c7 respectively
#use delay(clock=64000000,RESTART_WDT)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,ERRORS)
void version(void)
{
//------------------------------------------------------------------------------
//-- firmware version
//------------------------------------------------------------------------------
printf("\r\nTelemmote Receiver\r\n");
printf("TLM-02\r\n");
printf("Firmware v1.00\r\n");
printf("Compiled on \r\n");
printf(__DATE__);
printf("\r\n");
printf(__TIME__);
printf("\r\n");
//------------------------------------------------------------------------------
}
should work flawlesly but result is
U V W $ Y YZ Y C irmware v1.00
Compiled on
07-May-25
11:20:24 _________________ Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com
Do whatever you do with amateur spirit -
But always feel professional. |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9577 Location: Greensville,Ontario
|
|
Posted: Fri May 09, 2025 9:13 am |
|
|
Hmm....you don't have the 'delay_ms(250);' just before the first print. |
|
 |
allenhuffman
Joined: 17 Jun 2019 Posts: 627 Location: Des Moines, Iowa, USA
|
|
Posted: Fri May 09, 2025 9:54 am |
|
|
One of the four PIC24 boards I maintain had an issue with unreliable serial output, and it ended up being caused by a timer ISR. I had to move it to a different timer and then the output worked fine.
I have no idea why that was, but left myself a TODO in the comments to look into it... some day. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19943
|
|
Posted: Fri May 09, 2025 11:38 am |
|
|
Show your fuses.
How is the 64MHz generated????.
Show how the main code starts, and calls 'version'.
Did PUT make no difference at all?. |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9577 Location: Greensville,Ontario
|
|
Posted: Fri May 09, 2025 2:44 pm |
|
|
we really need to see the complete program ! |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19943
|
|
Posted: Fri May 09, 2025 11:54 pm |
|
|
More to the point, you really need to generate a basic test program that just
shows the issue. Simple main, and the code to call the version display.
Doing this then proves there isn't something hidden causing the issue as
Allen describes. Then post this. |
|
 |
scanan
Joined: 13 Aug 2004 Posts: 73 Location: Turkey
|
|
Posted: Mon Sep 15, 2025 7:30 am |
|
|
temtronic wrote: | curious....
you've made several changes so could you please post the program and the printout ?
thanks |
Hi,
solved the problem by adding
fputc(0); before all printfs. _________________ Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com
Do whatever you do with amateur spirit -
But always feel professional. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19943
|
|
Posted: Mon Sep 15, 2025 7:55 am |
|
|
That is interesting. Are you using some form of wireless connection?.
It sounds as if it needs to see the serial line actually transitioning high
to low to wake something up on the connection you have. |
|
 |
scanan
Joined: 13 Aug 2004 Posts: 73 Location: Turkey
|
|
Posted: Mon Sep 15, 2025 8:51 am |
|
|
Ttelmah wrote: | That is interesting. Are you using some form of wireless connection?.
It sounds as if it needs to see the serial line actually transitioning high
to low to wake something up on the connection you have. |
At startup ok I get What I want but when I put printf here and there for debugging
I get garbages
I get same result whit my PIC18f65k40.
I am using TTL ftdi USB converter. for connecting to my pc _________________ Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com
Do whatever you do with amateur spirit -
But always feel professional. |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9577 Location: Greensville,Ontario
|
|
Posted: Mon Sep 15, 2025 8:57 am |
|
|
Disable the WDT. If its setup wrong, can cause random garbage.....
WDT should only be enabled AFTER 100% of the program is 100% running properly, then you determine the WDT 'time out', code that, then test for a week. |
|
 |
scanan
Joined: 13 Aug 2004 Posts: 73 Location: Turkey
|
|
Posted: Mon Sep 15, 2025 9:18 am |
|
|
temtronic wrote: | Disable the WDT. If its setup wrong, can cause random garbage.....
WDT should only be enabled AFTER 100% of the program is 100% running properly, then you determine the WDT 'time out', code that, then test for a week. |
#FUSES NOEXTOSC,RSTOSC_HFINTRC_64MHZ //1
#FUSES NOCLKOUT,NOCKS//3
#FUSES NOFCMEN,NOMCLR,PUT,NOLPBOR,NOBROWNOUT //4
#FUSES ZCDDIS,NOPPS1WAY,NOSTVREN //6
#FUSES NODEBUG,NOXINST//,WDT1024 //7
#FUSES NOWDT,WDT_SW//10
#FUSES WRT,WRTC,NOWRTB,NOWRTD
#FUSES NOSCANE,NOLVP,NOPROTECT,NOCPD
#FUSES EBTR,EBTRB //15
#use delay(clock=8000000)
#use rs232(baud = 9600, parity = N, xmit = PIN_C6, rcv = PIN_C7, bits = 8)
setup_wdt(WDT_OFF);
setup_adc(ADC_OFF);
setup_adc_ports(NO_ANALOGS);
//setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
////clock 16MHZ 16000000/16/4=250000Hz (1/250000)*prescaler=interrupt period overflow time(1 ms) prescaler=65285
setup_timer_0(RTCC_INTERNAL | RTCC_DIV_4); //| RTCC_8_BIT);
setup_timer_1(T1_INTERNAL | T1_DIV_BY_1);
setup_timer_2(T2_DISABLED, 0xFF, 0x10);
setup_timer_3(T3_DISABLED);
//setup_comparator(NC_NC_NC_NC);
setup_comparator_1(NC_NC);
setup_comparator_2(NC_NC);
setup_comparator_3(NC_NC);
setup_vref(FALSE);
setup_low_volt_detect(FALSE);
setup_oscillator(OSC_HFINTRC_8MHZ );
clear_interrupt(INT_EXT1);
clear_interrupt(INT_EXT2);
handle_test_leds(1);
delay_ms(1500);
handle_test_leds(0);
version();
ext_int_edge(1, L_TO_H);
ext_int_edge(2, H_TO_L);
enable_interrupts(INT_EXT1);
enable_interrupts(INT_EXT2);
disable_interrupts(INT_LOWVOLT);
enable_interrupts(INT_TIMER0);
disable_interrupts(INT_TIMER1);
enable_interrupts(GLOBAL); _________________ Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com
Do whatever you do with amateur spirit -
But always feel professional. |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9577 Location: Greensville,Ontario
|
|
Posted: Mon Sep 15, 2025 9:46 am |
|
|
sigh...not a complete program..
after you enable the interrupts.... it does nothing ? As coded, it'd go to 'sleep'.
You really need to post the complete program. we can't see what's going on with just 'bits and pieces'.
BTW need to add 'errors' to the #use RS232(..... errors..... ) |
|
 |
|