Author |
Message |
Topic: SPI on 18F16Q41 |
colin382
Replies: 10
Views: 8577
|
Forum: General CCS C Discussion Posted: Fri Jan 26, 2024 5:20 am Subject: SPI on 18F16Q41 |
@Ttelmah
OK, sorry to miss the sublties of your code. Clearly one has to not only RTFM, but read what is NOT in the FM.
Taking on board your observations re spi_xfer() vs spi_write(), out of curiosi ... |
Topic: SPI on 18F16Q41 |
colin382
Replies: 10
Views: 8577
|
Forum: General CCS C Discussion Posted: Thu Jan 25, 2024 4:37 pm Subject: SPI on 18F16Q41 |
@guageguy
Here you go:
#include <18F16Q41.h>
#fuses NOWDT
#use delay(clock=16M)
#include <stdlib.h>
#pin_select SDO2=PIN_A2 // chip pin 17
#pin_select SDI2=PIN_B4
#pin_select S ... |
Topic: SPI on 18F16Q41 |
colin382
Replies: 10
Views: 8577
|
Forum: General CCS C Discussion Posted: Thu Jan 25, 2024 11:55 am Subject: Solved! |
@temtronic: RTFM is always good advice, but in this case the FM was in conflict with the compiler. Having read the manual and the help file I reached the conclusion that if I stayed with the hardware ... |
Topic: SPI on 18F16Q41 |
colin382
Replies: 10
Views: 8577
|
Forum: General CCS C Discussion Posted: Thu Jan 25, 2024 9:42 am Subject: SPI on 18F16Q41 |
Thanks for the advice,
I replaced the #use spi line with
#use spi(MODE=0, BITS=8, CLK=PIN_B6, DI=PIN_B4, DO=PIN_A2)
// chip pin 11 13 ... |
Topic: SPI on 18F16Q41 |
colin382
Replies: 10
Views: 8577
|
Forum: General CCS C Discussion Posted: Thu Jan 25, 2024 8:35 am Subject: SPI on 18F16Q41 |
Using Workshop compiler v5.105 on Windows 10
Several attempts to use SPI have failed,what am I doing wrong?
Latest code in entirety:
#include <18F16Q41.h>
#fuses NOWDT
#use delay(clock= ... |
Topic: Multiple UARTs |
colin382
Replies: 7
Views: 15215
|
Forum: General CCS C Discussion Posted: Tue Feb 21, 2023 10:45 am Subject: Multiple UARTs |
Good advice, as always. |
Topic: Multiple UARTs |
colin382
Replies: 7
Views: 15215
|
Forum: General CCS C Discussion Posted: Tue Feb 21, 2023 8:41 am Subject: Multiple UARTs |
Thanks Alan, your code looks like what I am trying to achieve, but I could not get it to work. I also studied the CCS ex_macro.c, but that didnt work either. So I guess I am going to have to set up si ... |
Topic: Multiple UARTs |
colin382
Replies: 7
Views: 15215
|
Forum: General CCS C Discussion Posted: Sat Feb 18, 2023 2:54 pm Subject: Multiple UARTs |
Thanks both, I'll just write separate functions for each. |
Topic: Multiple UARTs |
colin382
Replies: 7
Views: 15215
|
Forum: General CCS C Discussion Posted: Sat Feb 18, 2023 7:36 am Subject: Multiple UARTs |
I have a need for six UARTs on a single PIC16LF15325. Only the transmit lines are needed and I have written a simple function to take a byte and send it from a pin specified within the code.
Rather t ... |
Topic: Assemble long int from shifted bytes |
colin382
Replies: 9
Views: 17739
|
Forum: General CCS C Discussion Posted: Tue Jan 10, 2023 9:00 am Subject: Assemble long int from shifted bytes |
Thanks for the additional material. Like you I nearly always have the help file open. At 78 years old, it's even easier to forget. |
Topic: Assemble long int from shifted bytes |
colin382
Replies: 9
Views: 17739
|
Forum: General CCS C Discussion Posted: Tue Jan 10, 2023 7:28 am Subject: Assemble long int from shifted bytes |
Thanks temtronic, that worked perfectly.
"Why not use the make() function that CCS supplies ?"
because I didnt know it existed, nor did I expect it to exist! |
Topic: Assemble long int from shifted bytes |
colin382
Replies: 9
Views: 17739
|
Forum: General CCS C Discussion Posted: Tue Jan 10, 2023 6:10 am Subject: Assemble long int from shifted bytes |
I receive an int32 as four int8 and I need to reconstruct the original int32
e.g. Byte3 = 32, byte2 4, byte1 = 8 and byte0 =99
longInt = (Byte3<<24) gives the correct value of 536870912 b ... |
Topic: No SPI DO pin on PIC16LF15325 [Solved] |
colin382
Replies: 1
Views: 9430
|
Forum: General CCS C Discussion Posted: Mon May 09, 2022 7:50 am Subject: No SPI DO pin on PIC16LF15325 [Solved] |
SOLVED
A previous SPI setup had not been deleted. |
Topic: No SPI DO pin on PIC16LF15325 [Solved] |
colin382
Replies: 1
Views: 9430
|
Forum: General CCS C Discussion Posted: Mon May 09, 2022 7:36 am Subject: No SPI DO pin on PIC16LF15325 [Solved] |
Attempting to set up an SPI facility on 16LF15325 using statement
#use spi(MASTER, DI = PIN_C0, DO = PIN_C1, CLK = PIN_C2, FORCE_SW, BITS = 8)
followed by: spi_xfer(0xF8);
I note that DO in #us ... |
Topic: PIC18F16Q41 in DIP28 |
colin382
Replies: 3
Views: 14395
|
Forum: General CCS C Discussion Posted: Fri Jan 14, 2022 10:50 am Subject: PIC18F16Q41 in DIP28 |
Thanks for such a rapid reply.
Edit: My Bad- the chip is 20 pins, need more coffee. |
|