Jump to content

ayeung

EstablishedMember
  • Content Count

    18
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ayeung

  • Rank
    Newbrie
  1. Hey guys.. How would you join a 8-bit lsb and 8-bit msb to form a 16-bit short?? thanks & regards, Alan
  2. Hello guys.. Is it possible to allocate larger buffers than 256 bytes and include into a typedef struct?? Currently the entire size of my typedef struct is <256 bytes and this works, anything more and no joy. I guess is it possible to allocate large buffers is the underlining issue? Thanks, Alan
  3. Yes it should. Nobody argues about this. However PIC is not a good platform for a design that uses many function pointers. It's better either to review program architecture or move to different CPU. That's why we offer free compiler on our web site. Everybody can download and try it before purchasing. No This is C++ syntax and BoostC won't compile it. You need BoostC++ to compile such code. Regards, Pavel Hello Pavel, Thanks for the advice "It's better either to review program architecture or move to different CPU." Heres some advice also how about removing ANSI-C compatible from page 9 of your datasheet/manual. Regards, Alan
  4. Yes it should. Nobody argues about this. However PIC is not a good platform for a design that uses many function pointers. It's better either to review program architecture or move to different CPU. That's why we offer free compiler on our web site. Everybody can download and try it before purchasing. No This is C++ syntax and BoostC won't compile it. You need BoostC++ to compile such code. Regards, Pavel Hello Pavel, Even more basic then above, I cannot get this to compile?? Is there something that I am missing with structs and SB? struct { unsigned char name[30]; unsigned char street[40]; unsigned char city[20]; unsigned char state[3]; unsigned int zip; } addr_info; addr_info.zip=123; Regards, Alan
  5. Yes it should. Nobody argues about this. However PIC is not a good platform for a design that uses many function pointers. It's better either to review program architecture or move to different CPU. That's why we offer free compiler on our web site. Everybody can download and try it before purchasing. No This is C++ syntax and BoostC won't compile it. You need BoostC++ to compile such code. Regards, Pavel Ok, thanks for the info.
  6. Thanks for the reply, expensive or not it stands to reason for any compiler that is ANSI-C should be able to do function pointers in struct's, looking back this has been flagged years ago, and still no support?? Bit disapointed to say the least after splashing £100 for the compilier, actually this is the second time that I have purchased it. Anyhow is there a different way to get function pointers into structs?? Also could you please comment on this? typedef struct serial_if_driver_t{ unsigned char init_if(); unsigned char read_message(); unsigned char write_message(); } serial_if_driver_t; error: ',' expected ?? Cheers, Alan.
  7. I have this typedef struct, keep getiting error: missing right brace. typedef struct { unsigned char (*init_if)(void *instance); unsigned char (*read_message)(void *instance1); unsigned char (*write_message)(void *instance2); } serial_if_driver_t; I had a quick look around the forums, it seems that as far back as 2007 this was flagged as an issue, is there a solution?? Thanks, Alan
  8. All good, solved the problem. Forgot to set the prescaler value in the option register>> therfore the WDT was continually timing out before I could reset it with the hard to find reference to command ....clear_wdt() now I have slapped clear_wdt in where needed...nice 1.
  9. Thanks for the reply. My system is not a RTOS, I dont think that I have turned off the WDT, I enable the WDT so am presuming that it runs constantly, need to check this. TMR0 is used in places so I will investigate if this is screwing things up.cheers!
  10. Hello, I need to set my PIC into sleep mode. This is a bit of main..... as you can see I have a loop that basically waits for a switch to be pressed, however I would like to put the PIC in sleep mode at this stage, as the PIC will setup and be put into this state initially. This loop works fine until i stick the sleep() function in. void main( void ) { SYS_Init(); do { sleep(); SYS_OnIdle(); UI_Idle(); } while ( !UI_Proceed() ); more code etc... } I set my #pragma DATA _CONFIG, 0x01CC //0000 0001 1100 0100 I am using the PIC12F629, and the above pragma enables watch dog timer etc... Any ideas ???
  11. sorted out the gpio reg's issue---I had the compile options on library not application so it could not see the target PIC12F683 !!
  12. Dave, I think my problem is that the compiler does not know that I am targeting the pic12f683... because I get errors when I do this, and even when I change the GPIO and WPU to lower case. GPIO = B( SDAT ) | B( SCLK ) | B( SW_A ) | B( SW_B ) | B( SW_C ) WPU = B( SW_A ) | B( SW_B ); When I look in the P12F683.h file I see the following plus lots more ... //============================================= // Registers char indf@0x0000; char tmr0@0x0001; char pcl@0x0002; char status@0x0003; char fsr@0x0004; char gpio@0x0005; do I need to include this somewhere....#include <P12F683.h> ???? Thanks Alan
  13. How do I write and read to the PIC's registers?? I have included the system.h, yet I get errors when I try the following...I am trying to target the PIC12f683. A piece of my sourcecode.... trisio = B( SDAT ) | B( SCLK ) | B( SW_A ) | B( SW_B ) ); wpu = B( SW_A ) | B( SW_B ); cmcon = 4 | 2 | 1; // CMCON = B( CM2 ) | B( CM1 ) | B( CM0 ); the compilier says error: unknown identifier 'trisio' So how do i get at the registers in the PIC...like gpio or trisio. I figure that once I include the system.h I can do the above statements????because these registers are defined in P12f683.h file for instance it says.... / Definitions from P12F683.INC // Converted using inc2h v1.0, by John Nagle (http://www.jobie.com) //============================================= // PART = PIC 12F683 #define W 0x0000 #define F 0x0001 //============================================= // Registers char indf@0x0000; char tmr0@0x0001; char pcl@0x0002; char status@0x0003; char fsr@0x0004; char gpio@0x0005; char pclath@0x000A; Or do i need to add this...#include "P12f683.h" Any ideas, its doing my head in. Alan in Edinburgh.
  14. Thanks Dave, tried what you said however the data structure is a typedef struct-- typedef struct { BYTE Register; BYTE Data; } SBI_REG_WRITE[3]; above is the code you suggected and cannot be initilised as an array, and also the value of 3 in your array varies. There must be an easier way to do this, if it compilies with out hassle in HTC ---any suggestions?
×
×
  • Create New...