- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello I want for my project to send from my board to out pin a serios of bits 1 or 0 meaning the i will get
and again i dont want to use wavedac i want to send signals of 1 or 0 manually
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Without knowing any additional information, it seems like you have a number of options to do this.
You could write a function in software to write out 1s and 0s from a word manually, shifting out the bits manually by using Pin_Write(). That could look something like:
void Send_Byte(uint8_t out_byte){
uint8_t i, out_bit;
pin_write(0); //ensure signal starts at 0
for (i=0,i<8,i++){
out_bit = (out_byte >> i) & 0x01;
pin_write(out_bit); //Put bit onto the output pin
CyDelay(5); //bit time 5mS
}
pin_write(0); //return line to 0
}
You could also use a Shift Register component and connect shift_out to the output pin, which will shift out the bits onto the pin at the speed of the clock connected to the component. This would let the hardware shift handle the byte.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need a little more information do you want this done by switches or just have the pulses appear some place in the code. Also what voltage levels do you need and what PRF and what PRI. If you just need pules on a pin you can do that just from software. .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Without knowing any additional information, it seems like you have a number of options to do this.
You could write a function in software to write out 1s and 0s from a word manually, shifting out the bits manually by using Pin_Write(). That could look something like:
void Send_Byte(uint8_t out_byte){
uint8_t i, out_bit;
pin_write(0); //ensure signal starts at 0
for (i=0,i<8,i++){
out_bit = (out_byte >> i) & 0x01;
pin_write(out_bit); //Put bit onto the output pin
CyDelay(5); //bit time 5mS
}
pin_write(0); //return line to 0
}
You could also use a Shift Register component and connect shift_out to the output pin, which will shift out the bits onto the pin at the speed of the clock connected to the component. This would let the hardware shift handle the byte.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes but we have no ideal what he is trying to do to get to the end result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ye that is exactly what i want to do!!! to see pules on scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- void Send_Byte(uint8_t out_byte){
- uint8_t i, out_bit;
- pin_write(0); //ensure signal starts at 0
- for (i=0,i<8,i++){
- out_bit = (out_byte >> i) & 0x01;
- pin_write(out_bit); //Put bit onto the output pin
- CyDelay(5); //bit time 5mS
- }
- pin_write(0); //return line to 0
- }
This code will work if that all you want to do is put a pulse on the scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Worth noting though, if you actually want to send data and have something read it on the other end (not just see the bits on a scope) you would probably be better off using an actual UART or I2C.
With the code I posted, there's no way for a receiver on the other end to tell the difference between the 0V idle signal and the a leading zero of a byte. You would need a start bit of some kind to tell the receiver that a transmission is starting. A UART would handle start/stop bits automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok thank you all for the help