Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

getRC lib OK?

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Flyby123

Bascom Member



Joined: 05 Jul 2008
Posts: 73

blank.gif
PostPosted: Sun Feb 08, 2015 3:18 pm    Post subject: getRC lib OK? Reply with quote

Hi All,

I seem to have some issues with getRC and Bascom AVR.

Setup:
Bascom AVR 2.0.7.8
Board 1: Arduino Uno board (M328P)
Board 2: Chip45 Crumb Xmega128A3 board
RC network with 10K and 100n ceramic Cap, build as decribed in Bascom help file (getRC command).

Issue:
The Arduino board gives me a value via the comms terminal but it is always 1, even if I change capacitor value (up to 1u) or change resistor value (up to 100K).
Always the value 1, however it does generate a pulse (see scope screenshot).
FYI disconnecting the scope probe sees no difference (so no probe capacitive loading issue there).

For Xmega the value is always 0, and no pulse comes out of the pin, code slighly different.
Tried different ports and pins, result the same.

Lib Faulty?


Test code for Arduino board

Code:

 $regfile = "m328pdef.dat"                                ' used micro
   $crystal = 16000000                                      ' used xtal
   $baud = 19200                                            ' baud rate we want
   $hwstack = 40
   $swstack = 40
   $framesize = 40
   config clockdiv = 1                                      ' either use this or change the divider fuse byte


    '-------------------------------------------------------------------------------
    dim w as word , b as byte
    dim s as string * 6 , ar(6) as byte
    dim RCVal as word
    config portb = output                                   ' make portb an output



    do
     waitms 1000                                            ' wait 1 sec
      toggle portb                                          ' toggle level
      RCval = getrc(PIND , 7)
      print "RC value: " ; RCval                            ' test serial com
      w = w + 1 : s = str(w)                                    ' convert w to a string
      str2digits s , ar(1)                                      ' convert string into an array with binary numbers
    loop

    end
 



TIA

(BASCOM-AVR version : 2.0.7.8 )
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2165

netherlands.gif
PostPosted: Thu Feb 12, 2015 8:14 pm    Post subject: Reply with quote

I think your clock is to high, try it with an lower speed clock.
Code:

Clockdivision = 4
 

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
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
You cannot attach files in this forum
You cannot download files in this forum