Shop OBEX P1 Docs P2 Docs Learn Events
Reading Accellerometer from a COG — Parallax Forums

Reading Accellerometer from a COG

iseriesiseries Posts: 1,492
edited 2014-04-03 06:42 in Propeller 1
I'm trying to read an accelerometer from a COG and as soon as I do that all the data comes back as 1's. I can turn pins on and off but can not get any data except 1's from shift_in. Code works just fine without putting it in a COG. Code attached.
c
c
2K
h
h
920B
c
c
464B
.c 2.1K
.c 464B

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2014-04-02 16:52
    Each cog has its own pair of dira/outa registers. By calling high(PEna) in the caller's (application) context this pin is set high (and remains so until reset). Starting acc_Loop in another cog will render it inoperative. This is due to it calling acc_ReadByte which in turn tries to toggle PEna. This pin however is held high by the main cog (the one which had acc_Init called).
  • iseriesiseries Posts: 1,492
    edited 2014-04-03 06:42
    You are correct, reading the hardware manual I see that the pins are controlled by OR's. Out takes precedence over In and High over low. Reworked the code to move everything into the COG and we have readings again. Thank you.
Sign In or Register to comment.