pratiken
Newbie level 5
- Joined
- Mar 13, 2014
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 85
Hi guys,
I'm close, but am having trouble sending 6-bits to an IC that expects only 6 bits from my PIC18F2550.
DATASHEETS:
PIC: https://ww1.microchip.com/downloads/en/devicedoc/39632c.pdf
Hittite IC: https://www.hittite.com/content/documents/data_sheet/hmc624alp4.pdf
This is what the oscilloscope shows:
I think the last two bits are screwing up the attenuator. I can send all 1's and all 0's and that will make it go LOW or HIGH but if I try to send something like 0b010000 to get an attenuation half way then it won't work.
Is there a way to limit the clock cycles to 6 and not 8 so that only 6 bits get send out?
Here's my basic code from MikroC:
I'm close, but am having trouble sending 6-bits to an IC that expects only 6 bits from my PIC18F2550.
DATASHEETS:
PIC: https://ww1.microchip.com/downloads/en/devicedoc/39632c.pdf
Hittite IC: https://www.hittite.com/content/documents/data_sheet/hmc624alp4.pdf
This is what the oscilloscope shows:
I think the last two bits are screwing up the attenuator. I can send all 1's and all 0's and that will make it go LOW or HIGH but if I try to send something like 0b010000 to get an attenuation half way then it won't work.
Is there a way to limit the clock cycles to 6 and not 8 so that only 6 bits get send out?
Here's my basic code from MikroC:
Code:
#include <stdio.h>
unsigned int i;
unsigned char myByte = 0b111111;
void init(void){
ADCON0 = 0;
ADCON1 = 0x0f;
TRISB = 0;
TRISC = 0;
//TRISB.B1 = 0; // SCK
//TRISC.B7 = 0; // SDO
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
}
void main() {
init();
while(1){
Delay_ms(1);
LATB.B2 = 1;
SPI1_Write(myByte);
LATB.B2 = 0;
Delay_ms(100);
}
}