ADC2 Click example - what's SDI_bit?

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Rubbotron
Posts: 11
Joined: 17 Feb 2016 19:40

ADC2 Click example - what's SDI_bit?

#1 Post by Rubbotron » 23 Aug 2016 19:11

I'm working in mikroBasic Pro for dsPIC and I'm trying to use the ADC2 Click example. I cannot seem to find where the label SDI_bit comes from or where it is declared. I've searched through keywords and tokens but didn't find it. Here is the only place that it is found in the code:

while(SDI_bit) ' Conversion time: 75ms

ChipSelect = 1
Delay_us(1)
ChipSelect = 0
Inc(timer)
Delay_ms(10) ' polling SDI_bit on every 10ms

if (timer >= 20) then ' failsafe timer
result = -4 000000 ' no response from MCP3551;
end if
wend

Rubbotron
Posts: 11
Joined: 17 Feb 2016 19:40

Re: ADC2 Click example - what's SDI_bit?

#2 Post by Rubbotron » 24 Aug 2016 16:08

For additional clarification, I've attached a copy of the code.
Attachments
ADC2_Click_Example.zip
(29.92 KiB) Downloaded 158 times

User avatar
nadir.celebic
mikroElektronika team
Posts: 465
Joined: 15 Jun 2016 13:19

Re: ADC2 Click example - what's SDI_bit?

#3 Post by nadir.celebic » 25 Aug 2016 16:21

Hi,

Please follow these steps:
Right click on SDI_bit => Find Declaration (Ctrl+D)

' Alternative bit function
const SDI = 4 register
dim SDI_bit as sbit at PORTC.B4

Best Regards,
Nadir

Rubbotron
Posts: 11
Joined: 17 Feb 2016 19:40

Re: ADC2 Click example - what's SDI_bit?

#4 Post by Rubbotron » 25 Aug 2016 16:32

Thank you so much. I see it now. I am guessing that once the SPI port is initialized and defined using the SPI Library commands, the library sub procedures declare these variables, which is transparent to the programmer. Great tip! Who knows how long it would have taken me to locate that Find Declaration command. Thanks again! :D

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”