View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 26, 2020 6:54 pm |
|
|
Can you tell us your test procedure ?
What equipment is connected to your board ?
What software are you running (if any) to test your board ?
Give us a list of what you do to test it, so that we can do the same thing. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Wed Feb 26, 2020 8:27 pm |
|
|
Hi
I have a program I made 6 years ago with PIC16F1847 that the rs232 is working. Can't test it now as I need to connect keyboard and AC motor.
The .LST is like that:
Code: | .................... #use delay(internal=32M)
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B2,rcv=PIN_B1,bits=8,stream=PORT1,errors)
*
0056: BTFSS PIR1.TXIF
0057: GOTO 056
0058: MOVLB 03
0059: MOVWF TXREG
005A: MOVLB 00
005B: RETURN
*
00B6: BTFSS PIR1.RCIF
00B7: GOTO 0B6
00B8: MOVLB 03
00B9: MOVF RCSTA,W
00BA: MOVLB 00
00BB: MOVWF rs232_errors
00BC: MOVLB 03
00BD: MOVF RCREG,W
00BE: MOVWF @78
00BF: MOVLB 00
00C0: BTFSS rs232_errors.1
00C1: GOTO 0C5
00C2: MOVLB 03
00C3: BCF RCSTA.CREN
00C4: BSF RCSTA.CREN
00C5: MOVLB 00
00C6: RETURN |
What I see that in this program have two additional lines in in the TX:
Code: | 005A: MOVLB 00
005B: RETURN |
and one in the RX:
Maybe this gives a clue?
Best wishes
Joe |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 26, 2020 8:33 pm |
|
|
A clue about what ? I still don't know what you are doing to test program.
Are you just looking for the LED to flash ? Are you testing the serial ? ]
What makes you think the program fails. List your criteria.
If you are testing the serial, then post what terminal program you are
using on your PC, and post what characters or other data that you are
sending to your board. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Wed Feb 26, 2020 8:56 pm |
|
|
Sorry PCM Programmer, I didn't see your post before posting my last post.
The only thing connected to the boards are the LED, the TTL to USB cable (FTDI) and 5 VDC power supply.
The same ICD U64 programmer for all.
I have two laptops and testing with both.
I have the YAT terminal, works OK with the PIC18F26K22 as I mentioned before. I am working with YAT long time already.
Tested also with a very old very basic terminal, I have same results.
I am testing with the posted programs from my post before your last post with all 3 programs, they compiles and blink the LED with correct timing.
The test procedure:
* Connecting the TTL to USB cable to the board.
* Opening the YAT terminal.
* Connecting the power supply while OFF.
* Turning ON the power supply.
* Reading the default byte (0x0A) sent by the board (or attempting to read in the case of the 1840 & 1847) every 2 seconds.
* Sending one byte and get back data+1 (in the case of the 26K22). Repeating the send/receive a few times.
The byte I am sending is 0x55 or 0x44 or 0x33, getting back 0x56 or 0x45 or 0x34.
Hope it helps to help me
Best wishes
Joe |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 27, 2020 3:25 am |
|
|
gjs_rsdi wrote: |
with all 3 programs, they compiles and blink the LED with correct timing.
* Reading the default byte (0x0A) sent by the board (or attempting
to read in the case of the 1840 & 1847) every 2 seconds.
* Sending one byte and get back data+1 (in the case of the 26K22).
Repeating the send/receive a few times.
The byte I am sending is 0x55 or 0x44 or 0x33, getting back 0x56 or
0x45 or 0x34.
|
That's how it behaves if the test works. What results do you get if it fails ?
Post what happens when it fails. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Thu Feb 27, 2020 5:27 am |
|
|
What I mean about fail is that I don't get any serial communication. Just the LED blinks.
Working
With the 26K22 I am getting a byte every 2 seconds as expected and data+1 after sending a byte from the terminal.
Fails
With the 12F1840 and 16F1847 not getting a byte every 2 seconds and no data+1 after sending a byte from the terminal.
Best wishes
Joe |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 27, 2020 1:04 pm |
|
|
I installed CCS vs. 5.062 and tested it with a 16F1847. I used your test
program from here:
http://www.ccsinfo.com/forum/viewtopic.php?t=58552&start=14
It worked.
Have you checked your pinouts ?
The 18F26K22 uses pins C6, C7 for Tx, Rx.
The 16F1847 uses B2, B1 for Tx, Rx.
The 12F1840 uses A0, A1 for Tx, Rx.
When you change PICs, the serial port pins change. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9128 Location: Greensville,Ontario
|
|
Posted: Thu Feb 27, 2020 1:07 pm |
|
|
Any chance those PICs have assignable serial pins, using the APFCON register ?? IF so, what should be defaults may not be if the 'Wizard' is involved. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19253
|
|
Posted: Thu Feb 27, 2020 1:16 pm |
|
|
You are sure you are checking the right pins?.
The default is RX on RB1, TX on RB2.
You should also turn off the SPI peripheral since this can share the pins.
The code will differ massively, understand the PIC12/16 have different
instruction capabilities than the PIC18. The compiler generates working
code, so something is wrong in what is being done. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Thu Feb 27, 2020 5:10 pm |
|
|
Hi
I changed PIC's to new and everything working.
It seems that I damaged the PIC's during my testings
Sorry for all this topic and the time spent to try to help me
Apologizing for that
If the moderator can delete all this topic, please delete.
Best wishes
Joe |
|
|
|