Jump to content
43oh

!Qwert

Members
  • Content Count

    10
  • Joined

  • Last visited

About !Qwert

  • Rank
    Member

Recent Profile Visitors

415 profile views
  1. Okay, I found out that using pinMode, digitalWrite and digitalRead works and I can understand how my capacitive sensor is implemented. I got my sensor to get the number of cycles I am expecting since it is allowing the sensor to be discharged and charged at a rate where I can get better readings. Since the board is running at 80MHz, one cycle is 0.0125us so if I am not touching the pin, the value will be around 40 cycles with 4M ohm pulling it high. Then if I touch the sensor, the number jumps to ~200. I am still figuring out why the port manipulation does not work but the pinMode, digita
  2. I did some tests and concluded that my port definitions are the source of my issues. The value readCapacitivePin returns is 128. This is the case when I change the pins, the number of cycles, the resistor value and so on, meaning it will always be 128 This section of my code where I defined the port is likely the source as I checked on the oscilloscope does not give me a RC waveform: volatile uint32_t* port; //use digitalWrite volatile uint32_t* ddr; //use pinMode volatile uint32_t* pin; //use digitalRead // Here we translate the input pin number from // Arduino pin number
  3. Okay, after I tested this code on my tmc123g, I ran into a bad problem. When I compiled and uploaded the code, the serial monitor tells me that value of the capacitance is 128 but my main issue is that the LED lights up before I even touch my sensor. Most likely, the timing and cycles are not After looking and testing around what caused my error, I believe that the port manipulation is causing the pin to charge up be high and may not be discharging but again I cannot say for sure. I may be wrong but looking at the readCapacitivePin function I cannot make any progress on this. // Pin for
  4. Okay, Thank you for your help on this igor. I looked at the references at Energia.h for the lm4f cores and I believe for the pin register, I would use the portBASERegister for this. I do have some concerns. I found out that reason I got the error regarding the volatile uint8_t was because the example was using volatile uint8_t* port; volatile uint8_t* ddr; volatile uint8_t* pin; uint8_t values in the energia.h for MSP430. The energia.h for the ports uses uint32_t values instead so I changed them to use uint32_t: uint8_t readCapacitivePin(int pinToMeasure){ // This is how you decl
  5. Hi, Thanks for replying. About the other capacitive library, I am still working on it but I found this example as there is no external libraries to use and only port manipulation on the sketch to read a capacitive sensor (or voltage) reading. Also I can save up pin usage if I can complete this example. This example actually will help me understand more about how port registers and port manipulation to a degree, work between Arduino/other microcontrollers and my TM4C123G. Back to the topic, I assume that the many of the pins I have on the TM4C123G are capable of capacitive sensing. Here w
  6. I found an adaptation of a cap-sense sketch that uses port manipulation to create a capacitive sensor for Arduino to a MSP430. My question is that when I was using the sketch and adjusting it to use a tm4C123 device, I got these errors: TouchSensor.ino: In function 'uint8_t readCapacitivePin(int)': TouchSensor.ino:58:24: error: 'P1OUT' was not declared in this scope TouchSensor.ino:59:23: error: 'P1DIR' was not declared in this scope TouchSensor.ino:61:23: error: 'P1IN' was not declared in this scope I looked into this and found out on this post: http://forum.43oh.com/topic/5166-need-adv
  7. Ok, correct me if I get something wrong. So the HWREG is just allowing an extension reading of the total pins available according to the memory address. For adding the rest on #define DIRECT_MODE_INPUT(base, mask) #define DIRECT_MODE_OUTPUT(base, mask) I should look further on the GPIO.c at: for DIRECT_MODE_INPUT: //***************************************************************************** void GPIOPinTypeGPIOInput(uint32_t ui32Port, uint8_t ui8Pins) { // // Check the arguments. // ASSERT(_GPIOBaseValid(ui32Port)); // // Make the pin(s) be inputs. //
  8. Okay, I took the example and insert it to the header file. Of course, I saw the errors when I compiled it to see what would happen. Now I do have a new issue, you mentioned that I had to fill the Direct read and mode input/output with certain mask and base values. You also mentioned that the driverlib should give me the HWREG versions for those functions or looking at the Eneriga.h is another source to look at. Sorry that I am asking much but I am a beginner in learning how to properly port libraries. Why I need to insert something to the Direct read and mode input/output (is it the pin mappin
  9. Okay, I will try out the link you posted and the example code once I get the chance. Here is the cpp file along with the header file: /* CapacitiveSense.h v.04 - Capacitive Sensing Library for 'duino / Wiring https://github.com/PaulStoffregen/CapacitiveSensor http://www.pjrc.com/teensy/td_libs_CapacitiveSensor.html http://playground.arduino.cc/Main/CapacitiveSensor Copyright (c) 2009 Paul Bagder All right reserved. Version 05 by Paul Stoffregen - Support non-AVR board: Teensy 3.x, Arduino Due Version 04 by Paul Stoffregen - Arduino 1.0 compatibility, issue 146 fix vim: set ts=4: */
  10. I have an issue when using the Capacitive Sensing Library from Arduino. I used the ver. 5 that allows non-AVR boards to use the library. My problem is when I complied it in Energia, I get these errors: /Users/apple/Documents/Energia/libraries/CapacitiveSensor/CapacitiveSensor.h:94:2: error: 'IO_REG_TYPE' does not name a type /Users/apple/Documents/Energia/libraries/CapacitiveSensor/CapacitiveSensor.h:95:11: error: 'IO_REG_TYPE' does not name a type /Users/apple/Documents/Energia/libraries/CapacitiveSensor/CapacitiveSensor.h:96:2: error: 'IO_REG_TYPE' does not name a type /Users/apple/Docum
×
×
  • Create New...