Jump to content

ThomMoun

Members
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ThomMoun's Achievements

Member

Member (2/4)

0

Reputation

  1. Okay so i tried this : cbAInputMode(BoardNum, SINGLE_ENDED); long numberOfSamples = 1024; HGLOBAL mem; mem = cbWinBufAlloc32(2048); // int data = cbCInScan(BoardNum, 0, 0, numberOfSamples, 1, mem, CONTINUOUS); int data = cbAInScan(BoardNum, 0, 1, numberOfSamples, 20, BIP10VOLTS, mem, CONTINUOUS); for (int i = 0; i < numberOfSamples; i++) { printf("Echantillon %d : %d\n", i, data[&i]); } cbStopBackground(BoardNum, mem); cbWinBufFree(mem); in order to adquire 1024 samples, 20 samples/s/channel. My sensor is linked to chan0. but i have an unexpected mistake : Unhandled exception at 0x000000006087BFC9 (cbw64.dll) in PROJ2.exe: 0xC0000005: Access violation reading location 0x0000000000000014. Can you help me ? + If you have any informations about counting event please tell me ? Thanks in advance TM PS : seems that cbCInScan does exist for the USB1208FS-Plus
  2. It's not about the specifications of the sensor; it's more about selecting the appropriate functions to perform acquisitions at a specific frequency. I want to periodically gather information from a port. + Regarding the counter, are my uses of the event-counting functions correct? TM
  3. Okay i tried several things and nothing works. Can you clearly tell me what functions should i use to time an event, i want to adquire the data of a distance sensor every 2 seconds without using a loop. For the moment I try like that cbVIn(BoardNum, 0, BIP10VOLTS, &dist, 0, BACKGROUND); cbAInScan(BoardNum, 0, 0, 5, &rate, BIP10VOLTS, meme, CONTINUOUS); + I'm also trying with the counter, i want to count the event of a switch button "How many times did i press it" i did that : USHORT switchState; //unsigned short USHORT Count; ULStat = cbDConfigPort(BoardNum, FIRSTPORTA, DIGITALIN); while (!_kbhit()) { ULStat = cbDBitIn(BoardNum, FIRSTPORTA,0, &switchState); cbCIn32(BoardNum, 0, &Count); // we use the cnt port to count the number of button pressing printf("Number of clic %u\n", Count); Sleep(500); } but it does not work. Thanks in advance Best regards TM
  4. I would like to create a code that configures the SYNC port of my USB1208FSPlus to act as an external clock source (it seems possible according to the documentation). I will then connect this SYNC port to the TRIG_IN port on my card to trigger an event at each clock period. Additionally, I want to connect my LED and digital ports to this setup to toggle periodically the led without a loop. I'm a bit unsure about which functions to use and how to establish the connections between the ports. Regarding the counting of events, I came across the cbCIn() function. However, I'm unsure if it only works with cbCLoad. Will it count every event on a specific port? thanks in advance TM
  5. Hello John, As always i thanks you a lot for your answer ! So i can use the callback function to time some of my analog adquisitions ? I tried to time the toglling of my led with some trigger's related function : cbSetConfig(BOARDINFO, BoardNum, 0, BIADTRIGCOUNT, BIDACTRIGCOUNT); cbSetTrigger(BoardNum, TRIG_HIGH, 0, 0); ULStat = cbDConfigPort(BoardNum, FIRSTPORTA, DIGITALOUT); and then : ULStat = cbDInScan(BoardNum, FIRSTPORTA, 10, 1, 1, MemeHandle, &value); but it does not work. It builds well but says me that this function (cbDInScan) is not adapted for my card USB1208. I will like to not depend of a loop to make it. Is the trigger activated in the card or should i connect the trigger port ? If i want to count some events through the CNT port, should i use cbEnableEvent(). Thanks again TM
  6. Hello, First of all, thanks a lot for your help ! Now I am able to control and acquire the datas of all my sensors. I have some more few questions about the USB1208 card, those questions are more general and i did not found all my answers in the datasheet. Is there a solution to control a digital output with PWM ? Is it possible to use the hardware timer to run a C function periodically ? (toggling a led at a specific frequency for example) Is it possible to run a function when a digital pin changes its input? (callback ?) Can i count the events with an encoder ? and how can i interact with an analog input ? Thanks a lot in advance, (btw it works with codeblocks but devC still does not work) Best Regards TM
  7. Hello Okay, yeah acutally i finally chose the 5V "digital" port with a resistor. What do you think about my code ? Am i using the functions correclty ? It does not work yet. Best regards TM
  8. Does someone has an idea or some experience with analog port ...?
  9. Hello, Thanks, it works better with cbDBitOut ! Now am trying with analog sensors. By reading the datasheet i understand that it is not necessary to use a function as cbDConfigPort to prepare an analog port and i can directly use cbAOut and cbAIn. My sensor is a temperature sensor with 3 pins (adj, +, -), to collect its data i connected it to an anolog output to power it with 5V, and to an analog input to receive the voltage given back by the sensor. This solution does not work, so i think there are errors in my code or in my hardware configuration. #define RANGE BIP5VOLTS ULStat = cbAOut(BoardNum, ADDA1, RANGE, 5); ULStat = cbAOut(BoardNum, ADDA2, RANGE, 1); ULStat = cbAIn(BoardNum, CHANNEL, RANGE, &temperature); if (ULStat != 0) { printf("Erreur lors de la lecture des données analogiques.\n"); return 1; i have the same issue with the distance sensor. the temperature sensor : https://www.ti.com/lit/ds/symlink/lm335.pdf?ts=1685441744173&ref_url=https%3A%2F%2Fwww.ti.com%2Fproduct%2FLM335%2Fpart-details%2FLM335Z%2FNOPB%3Futm_source%3Dgoogle%26utm_medium%3Dcpc%26utm_campaign%3Docb-tistore-promo-asc_opn_en-cpc-storeic-google-wwe%26utm_content%3DDevice%26ds_k%3DLM335Z%2FNOPB%26DCM%3Dyes%26gclid%3DCjwKCAjwvdajBhBEEiwAeMh1U3xNuSXuxXPB2xmvuas6gYn7MyloL68uug54Y-4jCJYOqjNNP8sRTBoCuZoQAvD_BwE%26gclsrc%3Daw.ds
  10. Hello, How can i use more than 2 ports as a digital output ? I am currently using FIRSTPORTA and FIRSTPORTB to turn on blue and green but as soon as i try using SECONDPORTA or B to turn on red color (config + out), a mistake appears (digital port number error). I noticed that on Instacal i can only test those two first ports, is it related ? How can i activate the others ? Respectfully TM
  11. Hello, Thanks for those informations ! I'll try with Visual Studio. If you try it with DevC++ or Codeblocks, let me know. Thanks again !
  12. Hello, I am experiencing difficulties using the cbw library from Measurement Computing. I am working with the USB1208FS Plus card, and my current goal is to turn on and off an RGB LED using this card. The LED is connected to a breadboard. I am using the DevC++ IDE, but I am encountering errors in the makefile during compilation. Do you think I may have imported the library and the cbw.h header file incorrectly? Or is there a specific function that needs to be called before any other to ensure smooth compilation? I also tried using CodeBlocks, but my header file is either not being detected, or I have an issue with the precompiled file cbw.h.gch. If anyone can provide me with one or two hints, even if they are small, I would greatly appreciate it. Thank you in advance, TM
×
×
  • Create New...