CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

hb100 doppler

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ilker07



Joined: 03 Jun 2022
Posts: 39

View user's profile Send private message

hb100 doppler
PostPosted: Wed Dec 25, 2024 6:31 am     Reply with quote

Hi everyone I wanna use hb 100 with ccs c but Idon 't know how to get frequency through HB100.Please help.

The code :

#include <18F67K22.h>
#device ADC=12
#use delay(internal=16000000)


#FUSES NOWDT
#FUSES WDT128
#FUSES NOXINST
#FUSES NOBROWNOUT
#FUSES PROTECT

#include <math.h>


#pragma use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7, stream=uartScreen, errors)

void main() {




setup_adc_ports(sAN1);
setup_adc(ADC_CLOCK_DIV_32);
set_adc_channel(1);
delay_ms(100);




while (TRUE)
{
unsigned int16 adc=read_adc();
float volt=adc *0.001220703125;
fprintf(uartScreen,"%.3f\n",volt);
delay_ms(1);


}
}
ilker07



Joined: 03 Jun 2022
Posts: 39

View user's profile Send private message

PostPosted: Wed Dec 25, 2024 6:39 am     Reply with quote

[/b][/url]



if there is nothing it gives aprrox 2-3 volt. if there is any movement it gives between 0 and 4 volt depends on movement.if there is a lot of movement , The signal is getting too frequent.
ilker07



Joined: 03 Jun 2022
Posts: 39

View user's profile Send private message

PostPosted: Wed Dec 25, 2024 6:46 am     Reply with quote

How can I measure the frequency and magnitude of this signal?
temtronic



Joined: 01 Jul 2010
Posts: 9267
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 29, 2024 7:25 am     Reply with quote

1st... post which HB100 you're using. HB100 is just the sensor, and I assume you bought a 'module', which has a lot of components on it to make it 'computer friendly' ?

2nd, get rid of the #fuse protect ! NOT needed and limits life of PIC.

3rd, Use Google, search for code. You're not the 1st one doing this. probably a lot of Ardunio code, that can be easily translated into CCS C

4th, find proper manuals for the device and check IF it's a 5 volt or 3 volt device !!
Ttelmah



Joined: 11 Mar 2010
Posts: 19584

View user's profile Send private message

PostPosted: Sun Dec 29, 2024 10:33 am     Reply with quote

If you are reading the signal from an HB100, you do not want to be using
the ADC. This is not the right peripheral at all. Will not work at all.
The signal from the sensor needs putting through a circuit to turn it
into a detection pulse.
The actually data sheet has a suitable circuit in it, using 2 LM324 op-amps.
The Arduino code examples use this circuit, and measure the period
between the two digital pulses.
dyeatman



Joined: 06 Sep 2003
Posts: 1941
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Dec 29, 2024 11:42 am     Reply with quote

There is also an Application Note here:
https://www.openimpulse.com/blog/products-page/product-category/hb100-microwave-sensor-module/
_________________
Google and Forum Search are some of your best tools!!!!
ilker07



Joined: 03 Jun 2022
Posts: 39

View user's profile Send private message

PostPosted: Thu Jan 02, 2025 7:01 am     Reply with quote

Ttelmah wrote:
If you are reading the signal from an HB100, you do not want to be using
the ADC. This is not the right peripheral at all. Will not work at all.
The signal from the sensor needs putting through a circuit to turn it
into a detection pulse.
The actually data sheet has a suitable circuit in it, using 2 LM324 op-amps.
The Arduino code examples use this circuit, and measure the period
between the two digital pulses.



Yes ,I am aware of Arduino codes but I couldn't do it with CCS C.
ilker07



Joined: 03 Jun 2022
Posts: 39

View user's profile Send private message

PostPosted: Thu Jan 02, 2025 7:03 am     Reply with quote

dyeatman wrote:
There is also an Application Note here:
https://www.openimpulse.com/blog/products-page/product-category/hb100-microwave-sensor-module/


I red those 2 notes but I couldn't figure it out with CCS C.
ilker07



Joined: 03 Jun 2022
Posts: 39

View user's profile Send private message

PostPosted: Thu Jan 02, 2025 7:04 am     Reply with quote

temtronic wrote:
1st... post which HB100 you're using. HB100 is just the sensor, and I assume you bought a 'module', which has a lot of components on it to make it 'computer friendly' ?

2nd, get rid of the #fuse protect ! NOT needed and limits life of PIC.

3rd, Use Google, search for code. You're not the 1st one doing this. probably a lot of Ardunio code, that can be easily translated into CCS C

4th, find proper manuals for the device and check IF it's a 5 volt or 3 volt device !!


NO,that can NOT be easily translated into CCS C
temtronic



Joined: 01 Jul 2010
Posts: 9267
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 02, 2025 8:03 am     Reply with quote

hmm, wonder if one of those 'AI' apps can translate ?
I've never had ANY formal computer training courses on 'C' though I did take COBOL at night school for fun. I've used PCM since V2.534 and while my code ain't 'pretty' it works. Over the years, I've translated several Ardunio programs since 'they' seem to try new modules sooner than CCS guys do.
The actual translating is fairly easy once you understand what both compilers are doing. You simply break it down into smaller parts,see what Ardunio codes, then convert into CCS C. Run a few tests to confirm CCS code does the same, then onto the next .....
Ttelmah



Joined: 11 Mar 2010
Posts: 19584

View user's profile Send private message

PostPosted: Thu Jan 02, 2025 10:04 am     Reply with quote

Yes, actually the Arduino code _can_ always be easily translated into CCS
C, but usually just by looking at what it does, rather than the instructions
used.
This is the key point. It is the flow chart of the operations, that makes the
key to follow, not the actual code. This is also why usually it is easier to
just started from the manufacturers data sheet. That tells you what the
device expects and usually gives a flow of how things have to be done.
The key here is that the raw device _must_ have the signal processing
done before it's output can be read. This is the circuit in the data sheet.
The output from that circuit is not the waveform that has been posted, but
a simple digital sequence, with the time between the pulses directly related
to the speed. Very easy to read.
temtronic



Joined: 01 Jul 2010
Posts: 9267
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 02, 2025 10:14 am     Reply with quote

also.... once the Ardunio code is compiled, you can look at the listing and SEE the PIC machine code that was generated.
This can be used as a 'reference' when translating into CCS C.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group